Create Flutter Application

Create a new Flutter application and initialize it directly.XFlutter-CLI generate all reusable components such as (widgets, resources, base viewModel and injectable), configurations such as Native splash screen and Launcher icons, assets such as localization and images after create app.
xflutter_cli create

Result:

CLI provides two options to create the Flutter application Layer-Based Architecture and Feature-Based Architecture

Layer-Based Architecture:

  • xflutter_cli_test_application
    • android
    • assets
      • images
      • localization
      • svgs
    • ios
    • lib
      • data
      • di
      • environments
      • events
      • extensions
      • router
      • storage
      • ui
      • utilities
      • viewmodels
      • main.dart
    • analysis_options.yaml
    • build.yaml
    • flutter_launcher_icons.yaml
    • flutter_native_splash.yaml
    • pubspec.yaml
    • xflutter_cli.yaml

Feature-Based Architecture:

  • xflutter_cli_modules_application
    • android
    • assets
      • images
      • localization
      • svgs
    • ios
    • lib
      • common
        • data
        • di
        • environments
        • router
        • ui
        • viewmodels
      • core
        • events
        • extensions
        • storage
        • utilities
      • main.dart
    • analysis_options.yaml
    • build.yaml
    • flutter_launcher_icons.yaml
    • flutter_native_splash.yaml
    • pubspec.yaml
    • xflutter_cli.yaml

Create Application inside Workspace

  • Make sure to run the command in the workspace root directory.
  • Make sure applications are built through the CLI, because it manages the options and flags automatically.

Usage:

Name
Type
Description
Allowed Values
Format
nameoptionapplication name-snack case
packageoptionapplication package name-snack case
architectureoptionspecify application architecturelayers, modules
default-valuesflaginitialize with default values like colors-