File tree Expand file tree Collapse file tree 3 files changed +6
-18
lines changed
packages/flutter_tools/test/integration.shard/test_data Expand file tree Collapse file tree 3 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -217,19 +217,6 @@ const String lookupFunctionTemplate = '''
217217}''' ;
218218
219219const String lookupFunctionDeferredLoadingTemplate = '''
220- /// Lazy load the library for web, on other platforms we return the
221- /// localizations synchronously.
222- Future<@(class)> _loadLibraryForWeb(
223- Future<dynamic> Function() loadLibrary,
224- @(class) Function() localizationClosure,
225- ) {
226- if (kIsWeb) {
227- return loadLibrary().then((dynamic _) => localizationClosure());
228- } else {
229- return SynchronousFuture<@(class)>(localizationClosure());
230- }
231- }
232-
233220Future<@(class)> @(lookupName)(Locale locale) {
234221 @(lookupBody)
235222 assert(false, '@(class).delegate failed to load unsupported locale "\$ locale"');
@@ -243,7 +230,7 @@ const String lookupBodyTemplate = '''@(lookupAllCodesSpecified)
243230
244231const String switchClauseTemplate = '''case '@(case)': return @(localeClass)();''' ;
245232
246- const String switchClauseDeferredLoadingTemplate = '''case '@(case)': return _loadLibraryForWeb( @(library).loadLibrary, ( ) => @(library).@(localeClass)());''' ;
233+ const String switchClauseDeferredLoadingTemplate = '''case '@(case)': return @(library).loadLibrary().then((dynamic _ ) => @(library).@(localeClass)());''' ;
247234
248235const String nestedSwitchTemplate = '''case '@(languageCode)': {
249236 switch (locale.@(code)) {
Original file line number Diff line number Diff line change @@ -1006,7 +1006,7 @@ import 'output-localization-file_zh.dart';
10061006''' ));
10071007 });
10081008
1009- test ('imports are deferred when useDeferredImports are set' , () {
1009+ test ('imports are deferred and loaded when useDeferredImports are set' , () {
10101010 fs.currentDirectory.childDirectory ('lib' ).childDirectory ('l10n' )..createSync (recursive: true )
10111011 ..childFile (defaultTemplateArbFileName).writeAsStringSync (singleMessageArbFileString);
10121012
@@ -1033,6 +1033,7 @@ import 'output-localization-file_zh.dart';
10331033'''
10341034import 'output-localization-file_en.dart' deferred as output-localization-file_en;
10351035''' ));
1036+ expect (localizationsFile, contains ('output-localization-file_en.loadLibrary()' ));
10361037 });
10371038
10381039 group ('DateTime tests' , () {
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ class Home extends StatelessWidget {
9494 final List<String> results = [];
9595 return Row(
9696 children: <Widget>[
97- ResultBuilder (
97+ LocaleBuilder (
9898 test: 'supportedLocales',
9999 callback: (BuildContext context) {
100100 results.add('--- supportedLocales tests ---');
@@ -254,8 +254,8 @@ class Home extends StatelessWidget {
254254 ]);
255255 },
256256 ),
257- Builder (
258- builder : (BuildContext context) {
257+ LocaleBuilder (
258+ callback : (BuildContext context) {
259259 try {
260260 int n = 0;
261261 for (final String result in results) {
You can’t perform that action at this time.
0 commit comments