Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions lib/src/data_sources/asset_bundle_data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,12 @@ class AssetBundleLocalizationDataSource implements LocalizationDataSource {
///
/// Then the desired [bundlePath] should be `l10n`.
///
/// - [manifest] determines from where the namespaced files will be loaded
/// from. This file should contain a [Map] where the keys represent the
/// asset's path. Defaults to 'AssetManifest.json'.
///
/// The end result is a [Map] that contains all the namespaces which are
/// the file names themselves (case sensitive).
@override
Future<Map<String, dynamic>> load(
Locale locale, {
String manifest = 'AssetManifest.json',
}) async {
assert(manifest.isNotEmpty);

final assetFiles = await bundle
.loadString(manifest, cache: cache)
.then<Map<String, dynamic>>((string) => json.decode(string))
.then((map) => map.keys);
Future<Map<String, dynamic>> load(Locale locale) async {
final assetManifest = await AssetManifest.loadFromAssetBundle(rootBundle);
final assetFiles = assetManifest.listAssets();

/// On every platform you never should try to get the `path.separator`,
/// because Flutter is fetching all assets in `/` style.
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ repository: https://github.com/williamhjcho/i18next
homepage: https://github.com/williamhjcho/i18next

environment:
sdk: ">=2.18.0 <4.0.0"
sdk: ^3.10.0
flutter: ^3.38.1

dependencies:
collection: ^1.16.0
Expand Down