core/commands/launch/launch library

Classes

ControllerLaunchCommand
LaunchError
Generic / unrecognised error.
LaunchInvalidLauncherPid
The controller process PID could not be determined.
LaunchLauncherFailed
The controller process failed to start.
LaunchMissingDevice
No --device was provided.
LaunchProcessDied
The flutter process exited before the VM service URI appeared in the log.
LaunchResult
Result of a launchApp invocation.
LaunchSuccess
App launched successfully. VM service is reachable at vmServiceUri.
LaunchTimeout
The VM service URI did not appear within the launch timeout. tailLogLines contains the last 10 lines of the log (may be empty).

Functions

buildLaunchControllerArgs(List<String> controllerEntrypointArgs, {required String sessionDir, required String project, required String device, required String flutter, String? flavor, String? target, required List<String> dartDefines, required List<String> dartDefineFromFiles, required bool verbose}) → List<String>
cleanupLaunchSessionFiles() → void
Removes launch-owned session files before starting a new launch.
ensureGitignored(String projectPath) → void
Append .fdb/ to the project's .gitignore if not already present.
initLaunchSession({required String project, String? sessionDir}) → void
isPreviousSessionStale({Duration controllerTimeout = const Duration(seconds: 3)}) → Future<bool>
True when the session dir records a previous run whose app PID is no longer alive or whose controller does not answer a status request.
launchApp(LaunchInput input, {void onProgress(String projectPath) = _noop}) → Future<LaunchResult>
Launches a Flutter app as a detached background process and waits for the VM service URI to appear in the log.
queryVmPidFromUri(String vmUri) → Future<int?>
Reads the app process PID from the VM service at vmUri.
readLaunchPid() → int?
Reads the app or flutter-tools PID written during launch.
readLogTail({int count = 10}) → List<String>
Returns the last count lines of the session log, decoded tolerantly.
replacePreviousSession({bool stopApp = false, String progressPrefix = 'launch', void onProgress(String projectPath) = _noop}) → Future<void>
Stops what the previous session in the current session dir left behind and removes its files, so a new launch / attach can start cleanly.
resolveControllerLaunch() → ControllerLaunchCommand
resolveLaunchPid(String vmUri, {Future<int?> queryVmPid(String vmUri) = queryVmPidFromUri}) → Future<int?>
Resolves the PID to report once the VM service at vmUri is up.
writeAppIdFromProjectForLaunch(String projectPath, {String? flavor}) → void
Reads the app bundle id (iOS/macOS) or application id (Android) from the project's native config files and persists it to appIdFile.
writePlatformInfoForLaunch(String device, String flutter, {ProcessRunner processRunner = runProcessTolerant}) → Future<String?>
Queries flutter devices --machine to find the targetPlatform, emulator flag, and friendly name for device.

Typedefs

LaunchInput = ({List<String> dartDefineFromFiles, List<String> dartDefines, String? device, String? flavor, String? flutterSdk, bool interactive, String? project, String? sessionDir, String? target, int timeoutSeconds, bool verbose})
Input parameters for launchApp.
ProcessRunner = Future<ProcessResult> Function(String executable, List<String> arguments)