Metro Cli tool



Introduction

Metro is a CLI tool that works under the hood of the Nylo framework. It provides a lot of helpful actions to speed up development.


Install

Mac guide

  1. Open your bash_profile
sudo open ~/.bash_profile
  1. Add this alias to your bash_profile

    ...
    alias metro='flutter pub run nylo_framework:main'
  2. Then run the following

    source ~/.bash_profile

If you open a project that uses Nylo, try to run the following in the terminal.

metro

You should get an output similar to the below.

Metro - Nylo\'s Companion to Build Flutter apps by Anthony Gordon
Version: 1.0.0

Usage: 
    command [options] [arguments]

Options
    -h

All commands:
 make
  make:controller
  make:model
  make:page
  make:stateless_widget
  make:stateful_widget

 appicons
  appicons:build

 apispec
  apispec:build


Make controller

You can make a new controller by running the below in the terminal.

metro make:controller profile_controller

This is will create a new controller if it doesn't exist within the app/controllers directory.


Make model

You can make a new model by running the below in the terminal.

metro make:model product

This is will create a new model if it doesn't exist within the app/models directory.

metro make:model product --storable

You can also make a Storable model which can be saved to the users local storage.

Learn more on Storable models here


Make page

You can make a new page by running the below in the terminal.

metro make:page product_page

This is will create a new page if it doesn't exist within the common/pages directory.

metro make:page product_page -c

Create a page with a controller.


Make stateless widget

You can make a new stateless widget by running the below in the terminal.

metro make:stateless_widget product_rating_widget

This is will create a new widget if it doesn't exist within the resources/widgets directory.


Make stateful widget

You can make a new stateful widget by running the below in the terminal.

metro make:stateful_widget product_rating_widget

This is will create a new widget if it doesn't exist within the resources/widgets directory.


Building app icons

You can generate all the app icons for IOS and Android by running the below command.

metro appicons:build

This uses the pubspec.yaml configuration for your app icon. Check out the next section which explains how you can update your app icon in more detail.