Skip to content

Commit 74ae265

Browse files
committed
[flutterfire_cli] fix plugin selection on terminal during choices prompt
1 parent 8401e2a commit 74ae265

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

packages/flutterfire_cli/lib/src/commands/install.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ class InstallCommand extends FlutterFireCommand {
144144
.where(
145145
(element) => listAvailablePluginsInVersion.contains(element.name),
146146
)
147-
.map((plugin) => plugin.displayName)
148147
.toList();
148+
final displayNames = choices.map((plugin) => plugin.displayName).toList();
149149
final defaultSelection = List<bool>.filled(choices.length, false);
150150
for (final dependency in flutterApp!.package.dependencies) {
151-
final enumValue = FlutterFirePlugins.values.firstWhereOrNull(
151+
final enumValue = choices.firstWhereOrNull(
152152
(element) => element.name == dependency,
153153
);
154154
if (enumValue != null) {
155-
final index = choices.indexOf(enumValue.displayName);
155+
final index = choices.indexOf(enumValue);
156156
defaultSelection[index] = true;
157157
}
158158
}
@@ -161,11 +161,12 @@ class InstallCommand extends FlutterFireCommand {
161161

162162
final selectedChoices = promptMultiSelect(
163163
'Select the Firebase plugins you would like to install',
164-
choices,
164+
displayNames,
165165
defaultSelection: defaultSelection,
166166
);
167167
for (final index in selectedChoices) {
168-
selectedPlugins.add(FlutterFirePlugins.values[index]);
168+
// retrieve plugin based on the choices list
169+
selectedPlugins.add(choices[index]);
169170
}
170171
return selectedPlugins;
171172
}

0 commit comments

Comments
 (0)