@@ -10,6 +10,7 @@ import 'package:flutter_tools/src/commands/packages.dart';
1010import 'package:flutter_tools/src/dart/pub.dart' ;
1111import 'package:flutter_tools/src/project.dart' ;
1212import 'package:flutter_tools/src/reporting/reporting.dart' ;
13+ import 'package:flutter_tools/src/runner/flutter_command.dart' ;
1314import 'package:test/fake.dart' ;
1415
1516import '../../src/context.dart' ;
@@ -112,6 +113,52 @@ void main() {
112113 ProcessManager : () => FakeProcessManager .any (),
113114 FileSystem : () => fileSystem,
114115 });
116+
117+ testUsingContext ('pub get triggers localizations generation when generate: true' , () async {
118+ final File pubspecFile = fileSystem.currentDirectory.childFile ('pubspec.yaml' )
119+ ..createSync ();
120+ pubspecFile.writeAsStringSync (
121+ '''
122+ flutter:
123+ generate: true
124+ '''
125+ );
126+ fileSystem.currentDirectory.childFile ('l10n.yaml' )
127+ ..createSync ()
128+ ..writeAsStringSync (
129+ '''
130+ arb-dir: lib/l10n
131+ '''
132+ );
133+ final File arbFile = fileSystem.file (fileSystem.path.join ('lib' , 'l10n' , 'app_en.arb' ))
134+ ..createSync (recursive: true );
135+ arbFile.writeAsStringSync (
136+ '''
137+ {
138+ "helloWorld": "Hello, World!",
139+ "@helloWorld": {
140+ "description": "Sample description"
141+ }
142+ }
143+ '''
144+ );
145+
146+ final PackagesGetCommand command = PackagesGetCommand ('get' , false );
147+ final CommandRunner <void > commandRunner = createTestCommandRunner (command);
148+
149+ await commandRunner.run (< String > ['get' ]);
150+ final FlutterCommandResult result = await command.runCommand ();
151+
152+ expect (result.exitStatus, ExitStatus .success);
153+ final Directory outputDirectory = fileSystem.directory (fileSystem.path.join ('.dart_tool' , 'flutter_gen' , 'gen_l10n' ));
154+ expect (outputDirectory.existsSync (), true );
155+ expect (outputDirectory.childFile ('app_localizations_en.dart' ).existsSync (), true );
156+ expect (outputDirectory.childFile ('app_localizations.dart' ).existsSync (), true );
157+ }, overrides: < Type , Generator > {
158+ Pub : () => pub,
159+ ProcessManager : () => FakeProcessManager .any (),
160+ FileSystem : () => fileSystem,
161+ });
115162}
116163
117164class FakePub extends Fake implements Pub {
0 commit comments