slidy2 1.5.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 41

Pub GitHub stars Telegram

Actions Status Actions Status Actions Status Actions Status Actions Status

Acesse a documentação em Português-Brasil

slidy2 #

CLI package manager and template generator for Flutter. Generate Modules, Pages, Widgets, BLoCs, Controllers and tests.

slidy2 supports rxBLoC, flutter_bloc and mobx.

Why should I use? #

slidy2's goal is to help you structure your project in a standardized way. Organizing your app in Modules formed by pages, repositories, widgets, BloCs, and also create unit tests automatically. The Module gives you a easier way to inject dependencies and blocs, 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, so we're proposing a development pattern along with a tool that imitates NPM (NodeJS) functionality as well as template generation capabilities (similar to Scaffold ).

About the Proposed Pattern #

The structure that slidy2 offers you, it's similar to MVC, where a page keeps it's own business logic classes(BloC).

We recommend you to use get_modular when structuring with slidy2. It offers you the module structure(extending the ModuleWidget) and dependency/bloc injection, or you will probably get an error.

To understand get_modular, take a look at the README.

We also use the Repository Pattern, so the folder structure it's organized in local modules and a global module. The dependencies(repositories, BloCs, models, etc) can be accessed throughout the application.

Sample folder structure generated by slidy2:

Folder example

Installation #

  1. First of all you need install the Dart:

    https://dart.dev/get-dart

  2. Activate the slidy2 using the pub:

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

Commands: #

upgrade: #

Updates slidy2's version:

slidy2 upgrade

create: #

Create a new project with same structure describe in start command.

slidy2 create **myproject**

start: #

Create the basic structure of your project existing (make sure that your "lib" folder it's empty).

slidy2 start

Then choose your provider:

Folder example

Then choose your State Manager:

Mobx

Folder example

And you will get this Structure:

Folder example

Flutter Bloc:

Folder example

And you will get this Structure:

Folder example

Bloc With RxDart

Folder example

And you will get this Structure:

Folder example

If you have the flutter_bloc or flutter_mobx package in pubspec, the generation of pages, widgets, and bloc defaults to the installed manager default.

Options

The command allows to specify provider and state manager using the following options:

  • Provider:
-p <provider_name>

Options:
get_modular / bloc_pattern

Example:
slidy2 start -p get_modular
  • State manager:
-s <state_manager_name>

Options:
mobx / flutter_bloc / rxdart
Example:
slidy2 start -s mobx
  • Provider and state manager:
slidy2 start -p get_modular -s mobx

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

slidy2 start -p get_modular -s mobx -e

run: #

Runs the scripts in pubspec.yaml:

slidy2 run open_folder

Folder example

install: #

Installs or update the packages in dependencies:

Folder example

slidy2 install rxdart dio bloc_pattern

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

slidy2 i rxdart dio bloc_pattern

Install packages as dev_dependency:

slidy2 i mockito --dev

Folder example

uninstall: #

Removes a package

slidy2 uninstall dio

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

generate: #

Creates a module, page, widget or repository including its BloC class.

NOTE: You can replace "g" with "generate" command.

Creates a new module:

slidy2 g module folder_name

or

slidy2 g m folder_name

Folder example

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

Creates a new page + BloC:

slidy2 g page folder_name/pages

or

slidy2 g p folder_name/pages

Creates a new widget + BloC:

slidy2 g widget folder_name/widgets

or

slidy2 g w folder_name/widgets

NOTE: You can create a page or widget using its respective BLoC using the flag -b

Create a new repository

slidy2 g r folder_name/repositories

Create a new service

slidy2 g s folder_name/services

Create a new model

slidy2 g mm folder_name/model

You can also use "repository" in "r"'s place, but it will have the same function.

Folder example

Unit Tests: #

Generate unit tests on the test folder for you.

slidy2 test folder_name/

Common errors: #

I cant update:

1 - First of all you need uninstall the slidy2 on Flutter

flutter pub global deactivate slidy2

2 - After you need uninstall the slidy2 on Dart

pub global deactivate slidy2

2 - And now install only in Dart

pub global activate slidy2

3 - If you don't have the Pub you will need to install Dart:

https://dart.dev/get-dart

Windows:

Folder example

If you got this error when trying to run the pub global activate slidy2, then you will have to set the environment variables manually:

  • In windows search, write: Edit System Variables

    Folder example

  • Then click at Environment Variables

    Folder example

  • Go to Path

    Folder example

  • Then click in New and add the path that appeared on your console.

    Folder example

If you have any doubt about setting up the system variables, watch this video.

For more details join our Telegram Group Flutterando

1.5.2 #

  • Generate Store Command
    slidy2 generate store /path/store 
    
  • slidy2 create -m (state_managent) -p
  • Internal Core Modification
  • Now using ModularState in Generate Pages;

1.4.12 #

  • Create module withless named route system --noroute:
    slidy2 generate module /path/module --noroute [-n]
    
  • Added flag -p (provider system), -s (state management), -f (force) to start command (by lukelima);
  slidy2 start -p get_modular -s mobx -f 

1.4.7 #

  • Create reactive model template with --rx:
    slidy2 generate model /path/model_name --rx
    
  • get_modular as default provider;
  • Fix model template;

1.4.2+1 #

  • Fix test file generate error.

1.4.1 #

  • slidy2 CLI Interative
  • Fix slidy2 create erro

1.2.2 #

  • Added command generate model

1.2.1 #

  • Fix error install in flutter dart.
  • removed dart:mirrors.

1.2.0+1 #

  • Added flutter_bloc and mobx support.
  slidy2 start --flutter_bloc [-f]
  or
  slidy2 start --mobx [-m]

If you have the flutter_bloc or flutter_mobx package in pubspec, the generation of pages, widgets, and bloc defaults to the installed manager default.

  • Added flags "--flutter_bloc | -f" and "--mobx | -m" to generate bloc.
  • Added command "generate controller" (to mobx).

1.1.4 #

  • Added initModule in tests (check the documentation)

1.1.3 #

  • Create unity test widget when generate pages or widgets.
  • Flutter Dart 100% compatible
     flutter pub global activate slidy2
    

1.1.2 #

  • Added "service" command to generate auto disposed and injetable service.
     slidy2 generate service path-of-your-file
    

1.1.0 #

  • Now creating BLoCs or Repositories also creates Unitary Test files.
  • Added "test" command to "generate command".
     slidy2 generate test path-of-your-file
    

1.0.0 #

  • added command run, for exec your scripts in pubspec.yaml
  • Some commands have been improved for ease of usability for example the module, page and widget generation command have been shortened.
  • Fix errors

0.2.1 #

  • Removed folder App for main module.
  • File placement changes after "start -c" command.
  • The command "start -c" is being optimized to be the initial interface. We are working on the routes.

0.2.0 #

  • Added start -c, to start the project with routers, locations, and page structures

0.1.2 #

  • Added bloc command create;

0.1.1 #

  • Added param 'create';

0.0.1 #

  • Initial version, created by Stagehand

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:example/app/app_module.dart';

void main() => runApp(AppModule());

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate slidy2

2. Use it

The package has the following executables:


$ get

Use this package as a library

1. Depend on it

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


dependencies:
  slidy2: ^1.5.2

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:slidy2/slidy.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
41
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web

Because:

  • package:slidy2/slidy.dart that imports:
  • package:slidy2/src/modules/modules.dart that imports:
  • package:slidy2/src/modules/create.dart that imports:
  • package:slidy2/src/utils/utils.dart that imports:
  • package:slidy2/src/utils/pubspec.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:slidy2/slidy.dart that imports:
  • package:slidy2/src/modules/modules.dart that imports:
  • package:slidy2/src/modules/create.dart that imports:
  • package:slidy2/src/utils/utils.dart that imports:
  • package:slidy2/src/utils/pubspec.dart that imports:
  • dart:io

Health suggestions

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

Analysis of lib/src/utils/pubspec.dart reported 2 hints:

line 13 col 26: This function has a return type of 'Future

line 25 col 17: The stack trace variable 's' isn't used and can be removed.

Fix lib/src/modules/start.dart. (-0.50 points)

Analysis of lib/src/modules/start.dart reported 1 hint:

line 14 col 6: The declaration '_isContinue' isn't referenced.

Fix lib/src/modules/version.dart. (-0.50 points)

Analysis of lib/src/modules/version.dart reported 1 hint:

line 1 col 8: Unused import: 'package:slidy2/src/utils/utils.dart'.

Format lib/src/templates/templates.dart.

Run dartfmt to format lib/src/templates/templates.dart.

Format lib/src/utils/output_utils.dart.

Run dartfmt to format lib/src/utils/output_utils.dart.

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (dart_console, recase).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
ansicolor ^1.0.2 1.0.2
args ^1.5.2 1.6.0
dart_console ^0.5.0 0.5.0 0.6.2
http ^0.12.0+2 0.12.1
path ^1.6.2 1.7.0
recase ^2.0.1 2.0.1 3.0.0
tuple ^1.0.3 1.0.3
yaml ^2.1.16 2.2.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
ffi 0.1.3
http_parser 3.1.4
matcher 0.12.8
meta 1.2.2 1.3.0-nullsafety
pedantic 1.9.2
quiver 2.1.3
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
test ^1.9.4