MetroService class
Properties
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString ()
→ String
A string representation of this object.
inherited
Static Methods
addPackage (String package , {String ? version , bool dev = false })
→ Future <void >
Add a package to your pubspec.yaml file.
addPackages (List <String > packages , {bool dev = false })
→ Future <void >
Add a packages to your pubspec.yaml file.
addToConfig ({required String configName , required String classImport , required String createTemplate (String input ) })
→ Future <void >
Attempts to replace a file. Provide a configName to select which file to replace.
Then you can use the callback originalFile to get the file and manipulate it.
addToRouter ({String routerName = "router" , required String classImport , required String createTemplate (String input ) })
→ Future <void >
Attempts to replace a file. Provide a routerName to select which file to replace.
Then you can use the callback originalFile to get the file and manipulate it.
checkArguments (List <String > arguments , String usage )
→ void
Checks that a command has arguments.
createDirectoriesFromCreationPath (String ? creationPath , String folder )
→ Future <void >
Create directories from a creationPath.
createMetroProjectFile (String className , {Pattern prefix = "" })
→ MetroProjectFile
Finds the class name from a className from a String
and returns a MetroProjectFile object.
createPathForDartFile ({required String folderPath , required String className , String ? prefix , String ? creationPath })
→ String
Create a file path.
createSlate (List <NyTemplate > templates , {bool ? hasForceFlag })
→ Future <void >
Creates a new Slate using templates.
customCommandsMenu (List <NyCommand > commands )
→ String
Renders the menu section: project commands under [Custom Commands], each
package under [<package> Commands], descriptions aligned. Empty if none.
discoverCommands (List commandConfigs , {String scriptDirectory = commandsFolder , String ? package , String defaultCategory = 'app' , String ? workingDirectory })
→ Future <List <NyCommand > >
Builds sorted, de-duplicated NyCommand s from command configs. Scripts are
relative to scriptDirectory; package commands run in workingDirectory.
discoverCustomCommands ({Directory ? projectDirectory , Iterable <String > reservedCommands = const [] , void onWarning (String message )? })
→ Future <List <NyCommand > >
Discovers the project's commands.json commands plus package commands (see
discoverPackageCommands ). Precedence: reservedCommands, project, packages.
discoverPackageCommands ({Directory ? projectDirectory , void onWarning (String message )? })
→ Future <List <NyCommand > >
Discovers commands from packages in .dart_tool/package_config.json that ship
a metro_commands.json (like commands.json; scripts must live in bin/).
hasFile (String path )
→ Future <bool >
Check if a file exist by passing in a path.
hasHelpFlag (bool hasHelpFlag , String usage )
→ void
Checks if the help flag is set.
loadAsset (String assetPath )
→ Future <String >
Load an asset from the project using an assetPath.
makeApiService (String className , String value , {String folderPath = networkingFolder , bool forceCreate = false , bool addToConfig = true })
→ Future <void >
Creates a new API service.
makeCommand (String commandName , String value , {String folderPath = commandsFolder , bool forceCreate = false , String ? creationPath , String ? category })
→ Future <void >
Creates a new command file.
makeConfig (String configName , String value , {String folderPath = configFolder , bool forceCreate = false , String ? creationPath })
→ Future <void >
Creates a new config file.
makeController (String className , String value , {String folderPath = controllersFolder , bool forceCreate = false , String ? creationPath })
→ Future
Creates a new Controller.
makeDirectory (String folderPath )
→ Future
Creates a new Director.
makeEvent (String className , String value , {String folderPath = eventsFolder , bool forceCreate = false , bool addToConfig = true , String ? creationPath })
→ Future <void >
Creates a new Event.
makeForm (String className , String value , {String folderPath = formsFolder , bool forceCreate = false , String ? creationPath })
→ Future <void >
Creates a new Form.
makeInterceptor (String className , String value , {String folderPath = networkingInterceptorsFolder , bool forceCreate = false , String ? creationPath })
→ Future <void >
Create a new Interceptor.
makeJourneyWidget (String className , String value , {String folderPath = widgetsFolder , bool forceCreate = false , String ? creationPath })
→ Future <void >
Creates a new Journey Widget.
makeModel (String className , String value , {String folderPath = modelsFolder , bool forceCreate = false , bool addToConfig = true , bool ? skipIfExist = false , String ? creationPath })
→ Future <void >
Creates a new Model.
makeNavigationHub (String className , String value , {String folderPath = pagesFolder , bool forceCreate = false , bool addToRoute = true , bool isInitialPage = false , bool isAuthPage = false , String ? creationPath })
→ Future <void >
Creates a new Navigation Hub.
makePage (String className , String value , {String folderPath = pagesFolder , bool forceCreate = false , bool addToRoute = true , bool isInitialPage = false , bool isAuthPage = false , String ? creationPath })
→ Future <void >
Creates a new Page.
makeProvider (String className , String value , {String folderPath = providerFolder , bool forceCreate = false , bool addToConfig = true , String ? creationPath })
→ Future <void >
Creates a new Provider.
makeRouteGuard (String className , String value , {String folderPath = routeGuardsFolder , bool forceCreate = false , String ? creationPath })
→ Future <void >
Creates a new Route Guard.
makeStatefulWidget (String className , String value , {String folderPath = widgetsFolder , bool forceCreate = false , String ? creationPath })
→ Future <void >
Creates a new Stateful Widget.
makeStatelessWidget (String className , String value , {String folderPath = widgetsFolder , bool forceCreate = false , String ? creationPath })
→ Future <void >
Creates a new Stateless Widget.
makeStateManagedWidget (String className , String value , {String folderPath = widgetsFolder , bool forceCreate = false , String ? creationPath })
→ Future <void >
Creates a new State Managed Widget.
mergeCommands ({required List <NyCommand > projectCommands , required List <NyCommand > packageCommands , Iterable <String > reservedCommands = const [] , void onWarning (String message )? })
→ List <NyCommand >
Merges project and package commands. Precedence: reservedCommands (built-ins),
then project, then packages; a shadowed command is dropped with an onWarning.
runCommand (List <String > arguments , {required List <NyCommand ? > allCommands , required String menu })
→ Future <int >
Runs a command from the terminal. menu lists the runnable commands.
Returns the exit code; an action that does not return an int counts as 0.
runProcess (String command )
→ Future <int >
Runs a process
runProcessWithArguments (String executable , List <String > arguments , {String ? workingDirectory })
→ Future <int >
Runs executable with arguments (as a list, so spaces survive), sharing
the terminal's stdio, and returns its exit code.