Skip to content

Commit aa1e771

Browse files
committed
fix: use flutter.bat and dart file deletion for Windows compatibility
1 parent 4c83fc7 commit aa1e771

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,33 @@ class UpdateCommand extends FlutterFireCommand {
7676
commandRequiresFlutterApp();
7777

7878
logger.stdout('Cleaning up current workspace ...');
79+
final flutterCmd = Platform.isWindows ? 'flutter.bat' : 'flutter';
7980
await Process.run(
80-
'flutter',
81+
flutterCmd,
8182
['clean'],
8283
);
83-
await Process.run(
84-
'rm',
85-
['pubspec.lock'],
86-
);
84+
if (Platform.isWindows) {
85+
await File('pubspec.lock').delete();
86+
} else {
87+
await Process.run(
88+
'rm',
89+
['pubspec.lock'],
90+
);
91+
}
8792

8893
logger.stdout('Upgrading all firebase plugins to the latest version ...');
8994
for (final package in flutterfirePackages) {
9095
// We run each package individually because chaining them
9196
// will fail at the first package not in the pubspec.
9297
await Process.run(
93-
'flutter',
98+
flutterCmd, // reusing the flutterCmd variable which already made on line 79!
9499
['pub', 'upgrade', '--major-versions', package],
95100
);
96101
}
97102

98103
logger.stdout("Running 'flutter pub get'...");
99104
await Process.run(
100-
'flutter',
105+
flutterCmd, // reused flutterCmd again!
101106
['pub', 'get'],
102107
);
103108

0 commit comments

Comments
 (0)