cli library

The flutter3d command line, as functions: runFlutter3d, the whole command, and the parts a test or a tool calls on its own (convert, doctor, create project). Every file in bin/ is one line over runFlutter3d: bin/flutter3d.dart the command, the others its subcommands under their dart run flutter3d_build:<name> names.

A library of its own, not part of flutter3d_build.dart, which the build hook imports: the hook has no use for a Unity or USD reader and should not compile one.

Classes

CliExit
The exit codes every flutter3d subcommand answers with.
CliOptionSet
The options one subcommand reads: flags alone, valued with the argument after them (or --name=value).
ConvertCommandSettings
The parsed command line.
ConvertOutcome
How one input ended.
ConvertReport
One input's report.
DoctorCheck
One line of the doctor's report.
DoctorStatus
How a check came out.
ExternalTool
A program found or not, with what installs it.
ProjectKind
What a new project is for, which decides what lib/main.dart draws and what the project depends on.

Constants

blender → const ExternalTool
Blender, for .blend and for an .fbx when FBX2glTF is absent.
cliCommands → const List<String>
The subcommands, in the order flutter3d help lists them.
cliJsonBodies → const Map<String, String>
The keys each subcommand's --json document carries after command, as flutter3d help --surface prints them and api/flutter3d_build.cli commits them, so a key removed or renamed is a change somebody reviews. ? marks a key that may be absent; [...] a list of the object that follows.
cliJsonVersion → const int
The version of the --json output's shape, written in every document a subcommand prints with --json as the envelope's version.
cliOptions → const Map<String, CliOptionSet>
What each subcommand reads, by the words that name it (create plugin for the form of create that makes a plugin).
convertReportFormat → const FormatSpec
The file flutter3d convert --report <file> writes, for a FormatRegistry: the envelope, then reports, one ConvertReport an input.
convertReportVersion → const int
The version of the document --report writes, and the newest convertReportsFrom reads.
convertUsage → const String
flutter3d convert's help.
createUsage → const String
What flutter3d help create prints.
dartFloor → const String
The Dart every pubspec's floor names (SUPPORT.md, "The Flutter and Dart SDKs"). A structure test reads that section and holds these to it.
dartTested → const String
The Dart CI runs the plain Dart packages on.
decodeWorkerUsage → const String
What flutter3d help decode-worker prints.
doctorUsage → const String
What flutter3d help doctor prints.
externalTools → const List<ExternalTool>
Every converter tool, in the order doctor lists them.
fbx2gltf → const ExternalTool
FBX to glTF, the first choice for an .fbx.
flutter3dUsage → const String
What flutter3d prints with no arguments or help.
flutterFloor → const String
The Flutter floor of every package that names Flutter.
flutterTested → const String
The Flutter stable CI runs.
helpUsage → const String
What flutter3d help help prints.
initUsage → const String
What flutter3d help init prints, and what init prints to stderr after an unknown option or a second project directory.
lightmapUsage → const String
What flutter3d help lightmap prints.
lightsUsage → const String
What dart run flutter3d_build:lights prints when it is asked wrongly.
migrateUsage → const String
What flutter3d help migrate prints.
pluginsUsage → const String
What flutter3d help plugins prints.
shadersUsage → const String
What flutter3d help shaders prints.
usdcat → const ExternalTool
usdcat, for a binary (crate) USD layer.
visibilityUsage → const String
What flutter3d help visibility prints.

Functions

cliJson(String command, Map<String, Object?> body) → Map<String, Object?>
body as a subcommand's --json document: the format envelope every flutter3d JSON document starts with (format f3d.cli, version cliJsonVersion, requires, generator), then command, then the subcommand's own keys, whose shapes cliJsonBodies lists.
cliSurface() → String
The whole surface, as flutter3d help --surface prints it and api/flutter3d_build.cli commits it: the top-level usage, then each subcommand's own help under a == <command> == line.
compareVersions(String a, String b) → int
Compares two dotted versions, ignoring anything after a space or -. Negative when a is older.
convertReportDocument(Iterable<ConvertReport> reports) → Map<String, Object?>
reports as --report writes them.
convertReportsFrom(Object? json) → List<Map<String, Object?>>
The reports a --report file holds, each as ConvertReport.toJson wrote it: from the enveloped document, or from the bare list the file was before 1.0.
createProject(String target, String name, {ProjectKind kind = ProjectKind.scene}) → Answer
Writes a new project called name, of kind, into target, which must be empty or not exist, and wires the build hook. Returns what it did, or why it did not.
exitCodeFor(Iterable<ConvertOutcome> outcomes) → int
The exit code for a whole run: 0 when every input converted, otherwise the code of the most serious outcome — a failure (1) before a missing tool (3) before a refusal to overwrite (4).
isPackageName(String name) → bool
Whether name is a valid Dart package name.
projectAssetChecks(Directory project) → List<DoctorCheck>
What doctor says about a project's models (decision 54): whether a hook is there to convert what is under assets_src/, and whether flutter: assets: names every directory the converted files land in.
projectPlatformChecks(Directory project) → List<DoctorCheck>
What doctor says about the keys that turn Flutter GPU on for an application (decision 54): FLTEnableFlutterGPU and FLTEnableImpeller in macos/Runner/Info.plist and ios/Runner/Info.plist, and io.flutter.embedding.android.EnableFlutterGPU in Android's manifest.
projectShaderChecks(Directory project, {String? dart, String? engineRevision}) → List<DoctorCheck>
What doctor says about a project's shaders (D15, D19): whether its hook is there to write the engine's bundle, whether its pubspec ships what the hook writes, whether the bundle there was compiled on the SDK that builds it now — dart and engineRevision, when known — and whether every installed plugin's material was compiled in.
projectTemplate(String name, {ProjectKind kind = ProjectKind.scene}) → Map<String, String>
The text files of a new project called name, of kind, by path.
runConvertCommand(List<String> arguments, {IOSink? out, IOSink? err}) → Future<int>
flutter3d convert's main. Returns the exit code.
runDoctor(List<String> arguments, {IOSink? out}) → int
flutter3d doctor's main. Returns 1 when a required check failed.
runDoctorChecks({ProcessProbe probe = _probe, String? locate(ExternalTool tool)?, String? dartVersion, Directory? project}) → List<DoctorCheck>
Every check, in the order the report prints them.
runFlutter3d(List<String> arguments) → Future<int>
Runs flutter3d <command> [arguments] and returns its exit code (CliExit). Writes to stdout and stderr as the command does.
unknownOption(String option) → String
The sentence every command refuses an unknown option with, before its usage on stderr.

Typedefs

ProcessProbe = String? Function(String executable, List<String> arguments)
Runs a program and returns its stdout, or null when it cannot start or fails.

Exceptions / Errors

MissingToolException
A tool was needed and is not installed.
ToolFailedException
A tool ran and refused.