Skip to content

Conversation

@eseidel
Copy link
Contributor

@eseidel eseidel commented Jul 17, 2025

I chose this approach so we didn't have to write any code to read .fvmrc files, and all we do is just know to run fvm flutter rather than flutter when determining the version from the system-available flutter.

Fixes #1385

And is part of potentially fixing #2529.

@eseidel eseidel requested review from bryanoltman and felangel July 17, 2025 18:53
@codecov
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@eseidel eseidel mentioned this pull request Jul 17, 2025
/// Engine • revision 8cd19e509d (5 weeks ago) • 2025-06-12 16:30:12 -0700
/// Tools • Dart 3.8.1 • DevTools 2.45.1
/// ```
String? maybeParseFlutterVersionFromOutput(String output) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think we should consolidate this with ShorebirdFlutter. The intention of ShorebirdFlutter was to interface with the underlying Flutter installation. If we merged this we would have flutter --version execution and parsing in multiple places.

/// Returns the Flutter version from a FVM-installed Flutter if available.
String flutterVersionFromFVMFlutter(ShorebirdProcess process) {
try {
final output = process.runSync('fvm', ['flutter', '--version']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if fvm isn't available on the PATH? I can imagine cases where users create aliases for flutter which proxy to the underlying fvm installation behind the scenes 🤷

See also:

Tighter VSCode integration, with configuration and settings management. FVM will now automatically configure VSCode to use the correct Flutter SDK version, triggering a terminal path update, so you can just use flutter, commands instead of fvm flutter

https://pub.dev/packages/fvm/changelog#300

import 'package:pub_semver/pub_semver.dart';
import 'package:scoped_deps/scoped_deps.dart';
import 'package:shorebird_cli/src/executables/executables.dart';
import 'package:shorebird_cli/src/executables/flutter_version.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import shouldn't be needed if we export flutter_version from executables/executables.dart

Also the convention would be to create a class called Flutter under executables which exposes whatever we need from the underlying flutter tool. This is what the ShorebirdFlutter class was meant to do.

late ShorebirdEnv shorebirdEnv;
late ShorebirdFlutter shorebirdFlutter;
late ShorebirdValidator shorebirdValidator;
late ShorebirdProcess process; // Only used by resolveTargetFlutterRevision.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should just mock the direct dependency (e.g. ShorebirdFlutter or Flutter) and not have to mock a transitive dependency here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support fvm

3 participants