flutter_snow_blower 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • new50

Flutter Snow Blower! 🚀 #





Pub Version Documentation License: BSD-3-Clause Twitter: SnowmanLabs

🚀 Dart CLI tool to automate your tasks in a flutter project, like:

  • Create a project from a tested template
  • Generate components with your boilerplate like:
    • Pages
    • Widgets
    • Controllers
    • Modules
    • Repositories
    • Use cases (only for clean architecture)
    • Entities (only for clean architecture)
    • Tests
    • And others
  • Maintain a pattern in your project
  • Install, uninstall or update packages
  • Create and run scripts write in pubspec.yaml (run the build_runner for example)

📄 Table of Contents #

👏 Acknowledgment #

This package is a fork of Slidy package, basically the main difference between is the performance and mainly the support for Clean architecture with some adaptations to works better with the Snowman labs Style! Other new feature is the improvement to the start and create command, that you can create a new project with a pre-made login page, register page and home with all working as it needs to be, the only thing that you need to do is configure the authentication.

❓ Why should I use #

Snow Blower's goal is to help you to structure your project in a standardized way. Organizing your app in Modules formed by pages, repositories, widgets, controllers, and also create unit tests automatically. The Module gives you a easier way to inject dependencies and controllers, including automatic dispose. Also helps you installing the dependencies and packages, updating and removing them. The best is that you can do all of this running a single command.

🎯 Motivations #

We realized that the project pattern absence is affecting the productivity of most developers, and other problem that had happening was that the new developers of the project doesn't know the project pattern, and with this tool, all will create at the same pattern every time. So we're proposing a development pattern along with a tool that imitates NPM (NodeJS) functionality as well as template generation capabilities.

📦 Examples #

Examples of to-do apps that used flutter_snow_blower as base:

🔧 Install #

  1. First of all you need install the Dart:

    https://dart.dev/get-dart

  2. Activate the snow using the pub:

 pub global activate flutter_snow_blower
  1. Type snow --version to make sure everything is working properly. This command should return the installed version.

🎉 Usage #

Usage: snow <command> [arguments]

Global options:
-h, --help       Print this usage information.
-v, --version

Available commands:
  create      Create a Flutter project with basic structure
  g           Creates a module, page, widget or repository according to the option.
  generate    Creates a module, page, widget or repository according to the option.
  i           Install (or update) a new package or packages:
  install     Install (or update) a new package or packages:
  revert      Revert last command
  run         run scripts in pubspec.yaml
  start       Create a basic structure for your project (confirm that you have no data in the "lib" folder).
  uninstall   Remove a package
  update      Update a new package or packages.
  upgrade     Upgrade the Flutter Snow Blower CLI version

Run "snow help <command>" for more information about a command.

✨ Commands #

Command upgrade #

Upgrades snow version

snow upgrade

Command create #

Create a new project with same structure described in start command, but now with the same options of flutter create.

snow create <name-of-project>

Command start #

Create the basic structure for your project (make sure that your "lib" folder it's empty). This structure contains the most important things that almost all projects have, like i18n, flavors, a defined state and architecture...

snow start

You can start a complete project with a template of authentication, login and register page, simply by adding -c in the command:

snow start -c

Now choose in witch architecture do you want use in the project:

Folder example

And you will get this Structure depending on which architecture do you selected:

Clean architecture
example_clean
├─ lib
│  ├─ app
│  │  ├─ app_module.dart
│  │  ├─ app_widget.dart
│  │  ├─ i18n
│  │  │  ├─ app
│  │  │  │  └─ pages
│  │  │  │     └─ home_i18n.dart
│  │  │  └─ validators_i18n.dart
│  │  ├─ pages
│  │  │  └─ home
│  │  │     ├─ home_controller.dart
│  │  │     ├─ home_controller.g.dart
│  │  │     ├─ home_module.dart
│  │  │     └─ home_page.dart
│  │  ├─ styles
│  │  │  ├─ app_bar_theme_app.dart
│  │  │  ├─ app_color_scheme.dart
│  │  │  ├─ app_text_theme.dart
│  │  │  └─ app_theme_data.dart
│  │  ├─ utils
│  │  │  └─ validators.dart
│  │  └─ widgets
│  │     ├─ custom_alert_dialog
│  │     │  ├─ custom_alert_dialog.dart
│  │     │  └─ types
│  │     │     ├─ confirm_dialog.dart
│  │     │     └─ error_dialog.dart
│  │     ├─ example
│  │     │  └─ example_widget.dart
│  │     └─ observer_future
│  │        └─ observer_future.dart
│  ├─ app_flavor_values.dart
│  ├─ data
│  │  ├─ constants
│  │  │  ├─ constants.dart
│  │  │  └─ features.dart
│  │  ├─ data_sources
│  │  │  ├─ feature
│  │  │  │  ├─ feature_local_data_source.dart
│  │  │  │  └─ feature_remote_data_source.dart
│  │  │  └─ todo
│  │  │     ├─ todo_local_data_source.dart
│  │  │     └─ todo_remote_data_source.dart
│  │  ├─ helpers
│  │  │  ├─ error_mapper.dart
│  │  │  └─ extensions.dart
│  │  ├─ local
│  │  │  └─ hive_client.dart
│  │  ├─ mappers
│  │  │  ├─ index.dart
│  │  │  ├─ todo
│  │  │  │  └─ todo_mapper.dart
│  │  │  └─ user_mapper.dart
│  │  ├─ remote
│  │  │  └─ dio_client.dart
│  │  └─ repositories
│  │     └─ feature
│  │        └─ feature_repository_impl.dart
│  ├─ di
│  │  ├─ di.dart
│  │  ├─ di.iconfig.dart
│  │  └─ modules
│  │     ├─ local_module.dart
│  │     └─ remote_module.dart
│  ├─ domain
│  │  ├─ entities
│  │  │  ├─ todo
│  │  │  │  └─ todo_entity.dart
│  │  │  └─ user_entity.dart
│  │  ├─ repositories
│  │  │  └─ feature
│  │  │     └─ feature_repository.dart
│  │  └─ usecases
│  │     ├─ base
│  │     │  ├─ base_future_use_case.dart
│  │     │  ├─ base_stream_use_case.dart
│  │     │  └─ base_use_case.dart
│  │     ├─ entities
│  │     │  └─ user_entity.dart.dart
│  │     ├─ feature
│  │     │  └─ do_something_use_case.dart
│  │     └─ get_todo_list
│  │        └─ get_todo_list_use_case.dart
│  ├─ main_dev.dart
│  ├─ main_production.dart
│  └─ main_qa.dart
└─ test
   ├─ app
   │  ├─ i18n
   │  │  └─ app
   │  │     └─ pages
   │  │        └─ home_i18n_test.dart
   │  └─ pages
   │     └─ home
   │        ├─ home_controller_test.dart
   │        └─ home_page_test.dart
   ├─ data
   │  └─ remote
   │     └─ dio_client_test.dart
   ├─ drawer_features_example_test.dart
   └─ test_variants
      └─ flavors_test_variant.dart
Clean architecture (complete mode)
example_clean_complete
├─ lib
│  ├─ app
│  │  ├─ app_module.dart
│  │  ├─ app_widget.dart
│  │  ├─ i18n
│  │  │  ├─ app
│  │  │  │  └─ pages
│  │  │  │     └─ home_i18n.dart
│  │  │  ├─ login_i18n.dart
│  │  │  └─ validators_i18n.dart
│  │  ├─ pages
│  │  │  ├─ home
│  │  │  │  ├─ home_controller.dart
│  │  │  │  ├─ home_controller.g.dart
│  │  │  │  ├─ home_module.dart
│  │  │  │  └─ home_page.dart
│  │  │  ├─ login
│  │  │  │  ├─ login_module.dart
│  │  │  │  └─ pages
│  │  │  │     ├─ login
│  │  │  │     │  ├─ login_controller.dart
│  │  │  │     │  ├─ login_controller.g.dart
│  │  │  │     │  └─ login_page.dart
│  │  │  │     └─ register
│  │  │  │        ├─ register_controller.dart
│  │  │  │        ├─ register_controller.g.dart
│  │  │  │        └─ register_page.dart
│  │  │  └─ splash
│  │  │     ├─ splash_controller.dart
│  │  │     ├─ splash_controller.g.dart
│  │  │     ├─ splash_module.dart
│  │  │     └─ splash_page.dart
│  │  ├─ stores
│  │  │  └─ auth
│  │  │     ├─ auth_store.dart
│  │  │     └─ auth_store.g.dart
│  │  ├─ styles
│  │  │  ├─ app_bar_theme_app.dart
│  │  │  ├─ app_color_scheme.dart
│  │  │  ├─ app_text_theme.dart
│  │  │  └─ app_theme_data.dart
│  │  ├─ utils
│  │  │  └─ validators.dart
│  │  └─ widgets
│  │     ├─ custom_alert_dialog
│  │     │  ├─ custom_alert_dialog.dart
│  │     │  └─ types
│  │     │     ├─ confirm_dialog.dart
│  │     │     └─ error_dialog.dart
│  │     ├─ login
│  │     │  ├─ email_text_field_widget.dart
│  │     │  └─ password_text_field_widget.dart
│  │     └─ observer_future
│  │        └─ observer_future.dart
│  ├─ app_flavor_values.dart
│  ├─ data
│  │  ├─ constants
│  │  │  ├─ constants.dart
│  │  │  └─ features.dart
│  │  ├─ data_sources
│  │  │  └─ auth
│  │  │     ├─ auth_local_data_source.dart
│  │  │     └─ auth_remote_data_source.dart
│  │  ├─ helpers
│  │  │  ├─ error_mapper.dart
│  │  │  └─ extensions.dart
│  │  ├─ local
│  │  │  └─ hive_client.dart
│  │  ├─ mappers
│  │  │  ├─ auth_mapper.dart
│  │  │  ├─ index.dart
│  │  │  └─ user_mapper.dart
│  │  ├─ remote
│  │  │  └─ dio_client.dart
│  │  └─ repositories
│  │     └─ auth
│  │        └─ auth_repository_impl.dart
│  ├─ di
│  │  ├─ di.dart
│  │  ├─ di.iconfig.dart
│  │  └─ modules
│  │     ├─ local_module.dart
│  │     └─ remote_module.dart
│  ├─ domain
│  │  ├─ entities
│  │  │  ├─ auth_entity.dart
│  │  │  ├─ auth_status.dart
│  │  │  └─ user_entity.dart
│  │  ├─ repositories
│  │  │  └─ auth
│  │  │     └─ auth_repository.dart
│  │  └─ usecases
│  │     ├─ auth
│  │     │  ├─ get_auth_status_stream_use_case.dart
│  │     │  ├─ get_user_stream_use_case.dart
│  │     │  ├─ get_user_use_case.dart
│  │     │  ├─ login_user_email_use_case.dart
│  │     │  ├─ logout_user_use_case.dart
│  │     │  └─ register_user_email_use_case.dart
│  │     └─ base
│  │        ├─ base_future_use_case.dart
│  │        ├─ base_stream_use_case.dart
│  │        └─ base_use_case.dart
│  ├─ main_dev.dart
│  ├─ main_production.dart
│  └─ main_qa.dart
└─ test
   ├─ app
   │  ├─ i18n
   │  │  ├─ app
   │  │  │  └─ pages
   │  │  │     └─ home_i18n_test.dart
   │  │  └─ i18n_test.dart
   │  └─ pages
   │     └─ home
   │        ├─ home_controller_test.dart
   │        └─ home_page_test.dart
   ├─ data
   │  └─ remote
   │     └─ dio_client_test.dart
   ├─ drawer_features_example_test.dart
   └─ test_variants
      └─ flavors_test_variant.dart
MVC with modular
example_mvc_modular
├─ lib
│  ├─ app_flavor_values.dart
│  ├─ main_dev.dart
│  ├─ main_production.dart
│  ├─ main_qa.dart
│  └─ src
│     ├─ app_module.dart
│     ├─ app_widget.dart
│     ├─ i18n
│     │  └─ modules
│     │     └─ home_i18n.dart
│     ├─ modules
│     │  └─ home
│     │     ├─ home_controller.dart
│     │     ├─ home_controller.g.dart
│     │     ├─ home_module.dart
│     │     └─ home_page.dart
│     ├─ shared
│     │  ├─ clients
│     │  │  ├─ dio_client.dart
│     │  │  └─ hive_client.dart
│     │  ├─ constants
│     │  │  ├─ constants.dart
│     │  │  └─ features.dart
│     │  ├─ extensions
│     │  │  └─ extensions.dart
│     │  ├─ helpers
│     │  │  ├─ error_mapper.dart
│     │  │  └─ validators.dart
│     │  └─ widgets
│     │     ├─ custom_alert_dialog
│     │     │  ├─ custom_alert_dialog.dart
│     │     │  └─ types
│     │     │     ├─ confirm_dialog.dart
│     │     │     └─ error_dialog.dart
│     │     └─ observer_future
│     │        └─ observer_future.dart
│     ├─ styles
│     │  ├─ app_bar_theme_app.dart
│     │  ├─ app_color_scheme.dart
│     │  ├─ app_text_theme.dart
│     │  └─ app_theme_data.dart
│     └─ todo_repository.dart
└─ test
   └─ src
      ├─ i18n
      │  └─ modules
      │     └─ home_i18n_test.dart
      └─ modules
         └─ home
            ├─ home_controller_test.dart
            └─ home_page_test.dart

MVC with modular (complete mode)
example_mvc_modular_complete
├─ lib
│  ├─ app_flavor_values.dart
│  ├─ main_dev.dart
│  ├─ main_production.dart
│  ├─ main_qa.dart
│  └─ src
│     ├─ app_module.dart
│     ├─ app_widget.dart
│     ├─ i18n
│     │  ├─ login_i18n.dart
│     │  ├─ modules
│     │  │  └─ home_i18n.dart
│     │  └─ validators_i18n.dart
│     ├─ modules
│     │  ├─ home
│     │  │  ├─ home_controller.dart
│     │  │  ├─ home_controller.g.dart
│     │  │  ├─ home_module.dart
│     │  │  └─ home_page.dart
│     │  ├─ login
│     │  │  ├─ login_module.dart
│     │  │  └─ pages
│     │  │     ├─ login
│     │  │     │  ├─ login_controller.dart
│     │  │     │  ├─ login_controller.g.dart
│     │  │     │  └─ login_page.dart
│     │  │     └─ register
│     │  │        ├─ register_controller.dart
│     │  │        ├─ register_controller.g.dart
│     │  │        └─ register_page.dart
│     │  └─ splash
│     │     └─ splash_page.dart
│     ├─ shared
│     │  ├─ auth
│     │  │  ├─ auth_store.dart
│     │  │  ├─ auth_store.g.dart
│     │  │  └─ repositories
│     │  │     ├─ auth_repository.dart
│     │  │     └─ auth_repository_interface.dart
│     │  ├─ clients
│     │  │  ├─ dio_client.dart
│     │  │  └─ hive_client.dart
│     │  ├─ constants
│     │  │  ├─ constants.dart
│     │  │  └─ features.dart
│     │  ├─ extensions
│     │  │  └─ extensions.dart
│     │  ├─ helpers
│     │  │  ├─ error_mapper.dart
│     │  │  └─ validators.dart
│     │  ├─ models
│     │  │  └─ user_model.dart
│     │  └─ widgets
│     │     ├─ custom_alert_dialog
│     │     │  ├─ custom_alert_dialog.dart
│     │     │  └─ types
│     │     │     ├─ confirm_dialog.dart
│     │     │     └─ error_dialog.dart
│     │     ├─ email_text_field
│     │     │  └─ email_text_field_widget.dart
│     │     ├─ observer_future
│     │     │  └─ observer_future.dart
│     │     └─ password_text_field
│     │        └─ password_text_field_widget.dart
│     └─ styles
│        ├─ app_bar_theme_app.dart
│        ├─ app_color_scheme.dart
│        ├─ app_text_theme.dart
│        └─ app_theme_data.dart
└─ test
   └─ src
      ├─ i18n
      │  └─ modules
      │     └─ home_i18n_test.dart
      └─ modules
         └─ home
            ├─ home_controller_test.dart
            └─ home_page_test.dart

Options

The command allows to specify the architecture using the following options:

  • Architecture:
-a <architecture_name>

Options:
clean / mvc_modular

Example:
snow start -a clean

This command asks for permission to erase lib folder. If you don't want to see the warning, type the -f (force) flag:

snow start -a clean -f

Command run #

Runs the scripts in pubspec.yaml:

snow run mobx

Example in pubspec.yaml:

scripts:
  mobx: flutter pub run build_runner watch

You can also add vars to customize scripts

vars:
  runner: flutter pub run build_runner
  clean: flutter clean
  get: flutter pub get

scripts:
    mobx_build: $clean & $get & $runner build --delete-conflicting-outputs
    mobx_watch: $clean & $get & $runner watch --delete-conflicting-outputs

Running:

snow run mobx_build

Command install #

Installs or update a package in dependencies:

snow install rxdart dio bloc_pattern

Result:

Install example

or you can just use the i command (both are the same)

snow i rxdart dio bloc_pattern

Install packages as dev_dependency:

snow i mockito --dev

Result:

Folder example

Command uninstall #

Removes a package from dependencies

snow uninstall dio

You can also remove a dev_dependency using the flag --dev

snow uninstall mockito --dev

Command update #

Updates a package from dependencies

snow update dio

You can also update a dev_dependency using the flag --dev

snow update mockito --dev

Command revert #

Reverts the last command. E.g. When I created a page and by mistake I tipped wrong the name, then I run the revert command, that will erases all the last files created(the page file and your test file).

snow revert

Command generate #

Creates a module, page, widget, controller, repository, entity, data source, use cases or tests.

NOTE: You can replace g with generate command.

Creates a new module

This command generates a new module that will store the routes of the page and the binds(controllers, repositories or any class that you want to inject).

NOTE: You can create a "Complete Module" with Module, Page, Controller, tests for Page and for Controller using the flag -c

E.g. HomeModule generated: Source File
import 'package:example_clean/app/pages/home/home_controller.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:example_clean/app/pages/home/home_page.dart';

class HomeModule extends ChildModule {
  @override
  List<Bind> get binds => [
        Bind((i) => HomeController()),
      ];

  @override
  List<Router> get routers => [
        Router(Modular.initialRoute, child: (_, args) => HomePage()),
      ];

  static Inject get to => Inject<HomeModule>.of();
}

Commands to create:

snow g module <module_name>

or

snow g m <module_name>

Creates a new controller

This command generates a new controller with mobx state management.

E.g. HomeController generated: Source File
import 'package:mobx/mobx.dart';

part 'home_controller.g.dart';

class HomeController = _HomeControllerBase with _$HomeController;

abstract class _HomeControllerBase with Store {
  // @observable
  // int value = 0;
  //
  // @action
  // void increment() {
  //   value++;
  // }
}

Commands to create:

snow g controller <folder_name>/<page_name>

or

snow g c <folder_name>/<page_name>

Creates a new page

This command generates a new page with a controller.

NOTE: If you want to create a page without controller use the flag -c

E.g. HomePage generated: Source File
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'home_controller.dart';

class HomePage extends StatefulWidget {
  final String title;
  const HomePage({Key key, this.title = "Home"}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends ModularState<HomePage, HomeController> {
  //use 'controller' variable to access controller

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        children: <Widget>[],
      ),
    );
  }
}

Commands to create:

snow g page <folder_name>/<page_name>

or

snow g p <folder_name>/<page_name>

Creates a new widget

This command generates a new widget.

NOTE: You can create a widget using a controller using the flag -c

E.g. HomeWidget generated:

Command on example_clean project:

snow g widget widgets/example
Source File
import 'package:flutter/material.dart';

class ExampleWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Text("textFinder"),
    );
  }
}

Commands to create:

snow g widget <folder_name>/<widget_name>

or

snow g w <folder_name>/<widget_name>

Creates a new Data Source (only Clean architecture)

This command generates two new data source files, being them, the local and the remote data source.

E.g. TodoLocalDataSource and TodoRemoteDataSource generated:

Command on example_clean project:

snow g ds todo

TodoLocalDataSource: Source File

import 'package:injectable/injectable.dart';
import 'package:example_clean/data/local/hive_client.dart';

@injectable
class TodoLocalDataSource {
  final HiveClient _hiveClient;
  static const String box = "Todo";

  const TodoLocalDataSource(this._hiveClient);
}

TodoRemoteDataSource: Source File

import 'package:injectable/injectable.dart';

@injectable
class TodoRemoteDataSource {
  const TodoRemoteDataSource();
}

Commands to create:

snow g data_source <data_source_name>

or

snow g ds <data_source_name>

Creates a new Entity (only Clean architecture)

This command generates a basic entity, with your mapper extension and updates the file mappers/index.dart to better imports and better uses.

E.g. TodoEntity and TodoMapper generated:

Command on example_clean project:

snow g e todo

TodoEntity: Source File

import 'package:flutter/foundation.dart';

@immutable
class TodoEntity {
  const TodoEntity();

  @override
  String toString() => 'TodoInfo()'; // TODO Write toString of Todo

  @override
  bool operator ==(Object o) {
    if (identical(this, o)) return true;

    return o is TodoEntity; // TODO Write == operator of Todo
  }

  //@override
  //int get hashCode => property.hashCode; // TODO hashCode overrides of Todo

}

TodoMapper: Source File

import 'dart:convert';

import 'package:example_clean/domain/entities/todo/todo_entity.dart';

extension TodoMapper on TodoEntity {
  TodoEntity copyWith(
      // TODO Write copyWith of Todo
      ) {
    return TodoEntity(
        // TODO Write copyWith of Todo
        );
  }

  Map<String, dynamic> toMap() {
    return {
      // TODO Write toMap of Todo
    };
  }

  TodoEntity fromMap(Map<String, dynamic> map) {
    if (map == null) return null;

    return TodoEntity(
        // TODO Write fromMap of Todo
        );
  }

  String toJson() => json.encode(toMap());

  TodoEntity fromJson(String source) => fromMap(json.decode(source));
}

Commands to create:

snow g entity <entity_name>

or

snow g e <entity_name>

Creates a new Use case (only Clean architecture)

This command generates a use case.

E.g. GetTodoListUseCase generated:

Command on example_clean project:

snow g u get_todo_list
Source File
import 'package:example_clean/domain/usecases/base/base_future_use_case.dart';
import 'package:injectable/injectable.dart';

@injectable
class GetTodoListUseCase implements BaseFutureUseCase<void, void> {
  const GetTodoListUseCase();

  @override
  Future<void> call([void params]) {
    // TODO: implement call
    throw UnimplementedError();
  }
}

Commands to create:

snow g use_case <use_case_name>

or

snow g u <use_case_name>

Create a new repository

This command creates a new repository that will generate according to the architecture of the project.

NOTE: If you want to create a complete repository, with the local and the remote data source use the flag -c (only for clean architecture)

E.g. TodoRepository generated: (Clean architecture)

Command on example_clean project:

snow g r todo

TodoRepository: Source File

abstract class TodoRepository {
  // TODO Write methods of TodoRepository
}

TodoRepositoryImpl: Source File

import 'package:injectable/injectable.dart';
import 'package:example_clean/domain/repositories/todo/todo_repository.dart';

@Injectable(as: TodoRepository)
class TodoRepositoryImpl implements TodoRepository {
  const TodoRepositoryImpl();
}
E.g. TodoRepository generated: (Clean architecture, mode complete "-c")

Command on example_clean project:

snow g r todo -c

TodoLocalDataSource: Source File

import 'package:injectable/injectable.dart';
import 'package:example_clean/data/local/hive_client.dart';

@injectable
class TodoLocalDataSource {
  final HiveClient _hiveClient;
  static const String box = "Todo";

  const TodoLocalDataSource(this._hiveClient);
}

TodoRemoteDataSource: Source File

import 'package:injectable/injectable.dart';

@injectable
class TodoRemoteDataSource {
  const TodoRemoteDataSource();
}

TodoRepository: Source File

abstract class TodoRepository {
  // TODO Write methods of TodoRepository
}

TodoRepositoryImpl: Source File

import 'package:injectable/injectable.dart';
import 'package:example_clean/domain/repositories/todo/todo_repository.dart';

@Injectable(as: TodoRepository)
class TodoRepositoryImpl implements TodoRepository {
  const TodoRepositoryImpl();
}
E.g. TodoRepository generated: (MVC modular)

Command on example_mvc_modular project:

snow g r todo

TodoRepository: Source File

import 'package:flutter_modular/flutter_modular.dart';
import 'package:dio/dio.dart';

class TodoRepository extends Disposable {
  Future fetchPost(Dio client) async {
    final response =
        await client.get('https://jsonplaceholder.typicode.com/posts/1');
    return response.data;
  }

  //dispose will be called automatically
  @override
  void dispose() {}
}

Commands to create:

snow g repository <repository_name>

or

snow g r <repository_name>

Generating Unit tests

Generate unit tests on the test folder for you.

snow test <folder_name>/<dart_file>.dart

✅ Run tests #

pub run test

👤 Author #

Snowman labs #

snowmanlabs-logo

🤝 Contributing #

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

💚 Show your support #

Give a ⭐️ if this project helped you!

📝 License #

Copyright © 2020 Snowman labs.
This project is BSD-3 Clause licensed.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased #

0.1.1 - 2020-06-30 #

Added #

  • Added support to new version of flutter_snow_base

0.1.0 - 2020-06-25 #

Added #

  • Added example/README.md with the references of all the examples
  • Added new file on start command, the validators. Is an util that you can centralize all the validators of the application, and also your i18n file.

Fixes #

  • Reformated the code with pedantic rules
  • Fixed images of Readme
  • Fixed .gitignore errors
  • Fixed uninstall of packages with more than one line

0.0.1 - 2020-06-25 #

Added #

  • Initial version of the package.
  • Thanks to Denis Viana and to Lucas Polazzo that made this first version of the package!

example/README.md

This package provides multiple examples, according to the selected architecture and if you selected the complete mode.

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate flutter_snow_blower

2. Use it

The package has the following executables:


$ snow

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_snow_blower: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_snow_blower/flutter_snow_blower.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:flutter_snow_blower/flutter_snow_blower.dartpackage:flutter_snow_blower/src/modules/modules.dartpackage:flutter_snow_blower/src/modules/version.dartdart:io

Package not compatible with runtime web

Because of the import of dart:io via the import chain package:flutter_snow_blower/flutter_snow_blower.dartpackage:flutter_snow_blower/src/modules/modules.dartpackage:flutter_snow_blower/src/modules/version.dartdart:io

Health suggestions

Fix lib/src/templates/start/src/clean/data/data_sources/auth/auth_local_data_source.dart. (-0.50 points)

Analysis of lib/src/templates/start/src/clean/data/data_sources/auth/auth_local_data_source.dart reported 1 hint:

line 1 col 8: Unused import: 'package:flutter_snow_blower/src/enums/persistence_enum.dart'.

Fix lib/src/utils/pubspec.dart. (-0.50 points)

Analysis of lib/src/utils/pubspec.dart reported 1 hint:

line 5 col 8: Unused import: 'package:path/path.dart'.

Format lib/src/modules/create.dart.

Run dartfmt to format lib/src/modules/create.dart.

Fix additional 15 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/modules/run.dart (Run dartfmt to format lib/src/modules/run.dart.)
  • lib/src/modules/start/choose_persistence.dart (Run dartfmt to format lib/src/modules/start/choose_persistence.dart.)
  • lib/src/modules/start/create/clean/create_data_files.dart (Run dartfmt to format lib/src/modules/start/create/clean/create_data_files.dart.)
  • lib/src/modules/start/create/create.dart (Run dartfmt to format lib/src/modules/start/create/create.dart.)
  • lib/src/modules/start/create/mvc_modular/create_pages_files.dart (Run dartfmt to format lib/src/modules/start/create/mvc_modular/create_pages_files.dart.)
  • lib/src/modules/start/install_packages.dart (Run dartfmt to format lib/src/modules/start/install_packages.dart.)
  • lib/src/modules/uninstall.dart (Run dartfmt to format lib/src/modules/uninstall.dart.)
  • lib/src/modules/upgrade.dart (Run dartfmt to format lib/src/modules/upgrade.dart.)
  • lib/src/templates/generator/widget_test_generator.dart (Run dartfmt to format lib/src/templates/generator/widget_test_generator.dart.)
  • lib/src/templates/start/src/clean/data/data_sources/feature/feature_local_data_source.dart (Run dartfmt to format lib/src/templates/start/src/clean/data/data_sources/feature/feature_local_data_source.dart.)
  • lib/src/templates/start/src/clean/data/model/local/some_table.dart (Run dartfmt to format lib/src/templates/start/src/clean/data/model/local/some_table.dart.)
  • lib/src/templates/start/src/shared/clients/moor/dao/some_dao.dart (Run dartfmt to format lib/src/templates/start/src/shared/clients/moor/dao/some_dao.dart.)
  • lib/src/templates/start/src/shared/clients/moor/moor_db.dart (Run dartfmt to format lib/src/templates/start/src/shared/clients/moor/moor_db.dart.)
  • lib/src/templates/start/src/shared/widgets/login/email_text_field_widget.dart (Run dartfmt to format lib/src/templates/start/src/shared/widgets/login/email_text_field_widget.dart.)
  • lib/src/templates/start/src/shared/widgets/login/password_text_field_widget.dart (Run dartfmt to format lib/src/templates/start/src/shared/widgets/login/password_text_field_widget.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.8.1 <3.0.0
ansicolor ^1.0.2 1.0.2
args ^1.6.0 1.6.0
dart_console ^0.6.1 0.6.2
http ^0.12.1 0.12.1
path ^1.7.0 1.7.0
pubspec_yaml ^2.0.1 2.0.1
recase ^3.0.0 3.0.0
tuple ^1.0.3 1.0.3
yaml ^2.2.1 2.2.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13
ffi 0.1.3
functional_data 0.3.0
http_parser 3.1.4
json2yaml 1.0.1
matcher 0.12.8
meta 1.1.8
plain_optional 0.1.3
quiver 2.1.3
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
sum_types 0.2.1+2
term_glyph 1.1.0
typed_data 1.2.0
win32 1.6.5
Dev dependencies
pedantic ^1.9.0 1.9.0 1.9.1
test ^1.14.3