From 5821ddc1192560be3caaeac7d3fbc39e97f83419 Mon Sep 17 00:00:00 2001 From: xalanq Date: Wed, 19 Nov 2025 03:55:45 +0800 Subject: [PATCH] chore: support flutter 3.38 --- .../data_sources/asset_bundle_data_source.dart | 17 +++-------------- pubspec.yaml | 3 ++- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lib/src/data_sources/asset_bundle_data_source.dart b/lib/src/data_sources/asset_bundle_data_source.dart index b7478d6..9c6f84b 100644 --- a/lib/src/data_sources/asset_bundle_data_source.dart +++ b/lib/src/data_sources/asset_bundle_data_source.dart @@ -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> load( - Locale locale, { - String manifest = 'AssetManifest.json', - }) async { - assert(manifest.isNotEmpty); - - final assetFiles = await bundle - .loadString(manifest, cache: cache) - .then>((string) => json.decode(string)) - .then((map) => map.keys); + Future> 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. diff --git a/pubspec.yaml b/pubspec.yaml index 16f4326..7bdaef0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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