import 'dart:io'; import 'package:path/path.dart' as p; /// Uses the SDK running Flutter tests without invoking its shell launcher. String flutterTestDartExecutable() { final root = Platform.environment['FLUTTER_ROOT']; if (root == null || root.isEmpty) { throw StateError( 'Flutter tests require FLUTTER_ROOT to select their Dart SDK.', ); } final executable = p.join( root, 'bin', 'cache', 'dart-sdk', 'bin', Platform.isWindows ? 'dart.exe' : 'dart', ); if (!File(executable).existsSync()) { throw StateError( 'The Flutter test SDK is missing its native Dart executable.', ); } return executable; }