@@ -147,6 +147,9 @@ class NewCommand {
147147
148148 // Update app title
149149 await _updateAppTitle (projectPath, projectName);
150+
151+ // Update test file imports
152+ await _updateTestImports (projectPath, projectName);
150153 }
151154
152155 /// Updates Android-specific configuration
@@ -207,6 +210,24 @@ class NewCommand {
207210 }
208211 }
209212
213+ /// Updates test file imports from `import '/` to `import 'package:<name>/`
214+ Future <void > _updateTestImports (
215+ String projectPath, String projectName) async {
216+ final testDir = Directory (path.join (projectPath, 'test' ));
217+ if (! await testDir.exists ()) return ;
218+
219+ await for (final entity in testDir.list (recursive: true )) {
220+ if (entity is File && entity.path.endsWith ('.dart' )) {
221+ String content = await entity.readAsString ();
222+ if (content.contains ("import '/" )) {
223+ content =
224+ content.replaceAll ("import '/" , "import 'package:$projectName /" );
225+ await entity.writeAsString (content);
226+ }
227+ }
228+ }
229+ }
230+
210231 /// Runs flutter pub get in the project directory
211232 Future <void > _runPubGet (String projectPath) async {
212233 final result = await ProcessRunner .run (
@@ -237,10 +258,18 @@ class NewCommand {
237258 ['run' , 'nylo_framework:main' , 'make:key' ],
238259 workingDirectory: projectPath,
239260 );
240-
241261 if (result.exitCode != 0 && result.stderr.trim ().isNotEmpty) {
242262 NyloConsole .writeWarning ('App key generation completed with warnings' );
243263 }
264+
265+ final resultMakeEnv = await ProcessRunner .run (
266+ 'dart' ,
267+ ['run' , 'nylo_framework:main' , 'make:env' ],
268+ workingDirectory: projectPath,
269+ );
270+ if (resultMakeEnv.exitCode != 0 ) {
271+ NyloConsole .writeWarning ('App key generation completed with warnings' );
272+ }
244273 }
245274
246275 /// Prints the success message with next steps
0 commit comments