flame_cli library

Classes

CreateTemplate
A template that flame create writes on top of the project that flutter create generated.
ExitCode
Exit code constants.
FlameCommandRunner
The runner of the flame command, which returns the exit code instead of throwing when a command fails.
FlameConnection
A connection to a Flame game that is running in debug mode, through the service extensions that Flame registers for the DevTools extension.
ImageDiff
The result of comparing two images with diffImages.
RunController
Manages a flutter run process that was started by flame run.

Enums

RunRequest
The request that the reload and restart commands send to flame run, as one line on the control port.

Constants

controlPortFileName → const String
The name of the file that flame run writes the port to that it accepts commands such as reload on.
logFileName → const String
The name of the file that flame run writes the output of flutter run to.
vmServiceUriFileName → const String
The name of the file that flame run writes the Dart VM Service URI of the running game to.

Properties

flameDirectoryPath → String
The directory inside the project, relative to the project directory, that flame run keeps its files in.
final
vmServiceUriFilePath → String
The path, relative to the project directory, of the file that flame run writes the Dart VM Service URI of the running game to.
final

Functions

diffImages(Image before, Image after, {int threshold = 0}) → ImageDiff
Compares before and after, which have to have the same size.
filterComponentTree(Map<String, dynamic> node, bool matches(Map<String, dynamic> node)) → Map<String, dynamic>?
Keeps the nodes of the tree that matches, together with their ancestors and their descendants, so that the path to every match is preserved and the matches are shown in full.
findProjectFile(Directory directory, String name) → File?
Finds the file with the given name that flame run keeps for a project, by looking in directory and then in each of its parents.
findProjectRoot(Directory directory) → Directory
Finds the root directory of the project that directory is in, which is the closest directory with a pubspec.yaml, looking in directory and then in each of its parents.
findVmServiceUriFile(Directory directory) → File?
Finds the file that flame run wrote the Dart VM Service URI to, by looking in directory and then in each of its parents.
flameDirectory(Directory projectDirectory) → Directory
The directory that flame run keeps its files in, for the project in projectDirectory.
formatAttributes(Map<String, dynamic> attributes) → String
Formats the attributes of a component on one line, leaving out the ones that have their default value.
formatComponentInfo(Map<String, dynamic> info) → String
Formats the response of the getComponentInfo service extension with one line per field.
formatComponentTree(Map<String, dynamic> node, {int depth = 0, int? maxDepth}) → String
Formats the tree returned by the ext.flame_devtools.getComponentTree service extension with one component per line, indented by its depth in the tree, and with the attributes of the component after the id.
projectFile(Directory projectDirectory, String name) → File
The file with the given name that flame run keeps for the project in projectDirectory.
sendRunRequest(Directory workingDirectory, RunRequest request, {int? port}) → Future<Map<String, dynamic>>
Sends request to the flame run of the project that workingDirectory is in, or to the one listening on port if given, and returns its response.
toJsonOutput(Object? value) → String
Encodes value as indented JSON, for the --json output of the commands.
validateProjectName(String name) → String?
Returns why name cannot be the name of a game, or null if it can.
vmServiceUriFile(Directory projectDirectory) → File
The file that flame run writes the Dart VM Service URI to, when it is started in projectDirectory.
webSocketUri(String uri) → Uri
Converts the http URI that flutter run prints for the Dart VM Service to the web socket URI that the service is connected through.

Typedefs

ProcessStarter = Future<Process> Function(String executable, List<String> arguments, {ProcessStartMode mode, bool runInShell, String? workingDirectory})
Starts a process, with the same signature as Process.start.

Exceptions / Errors

FlameCliException
An error that stops a command, with a message that is meant to be shown to the user and the exitCode that the process should exit with.