diff --git a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart index befbbaf566..3dcbf92c5b 100644 --- a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart +++ b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart @@ -195,9 +195,12 @@ class FuchsiaReloadCommand extends FlutterCommand { return; } - final List gnTarget = _extractPathAndName(argResults['gn-target']); - _projectRoot = gnTarget[0]; - _projectName = gnTarget[1]; + final String gnTarget = argResults['gn-target']; + if (gnTarget == null) + throwToolExit('Give the GN target with --gn-target(-g).'); + final List targetInfo = _extractPathAndName(gnTarget); + _projectRoot = targetInfo[0]; + _projectName = targetInfo[1]; _fuchsiaProjectPath = '$_fuchsiaRoot/$_projectRoot'; if (!_directoryExists(_fuchsiaProjectPath)) throwToolExit('Target does not exist in the Fuchsia tree: $_fuchsiaProjectPath.');