easy 2.0.0+1

Easy #

An easy Flutter state management that allows minimal rebuild of widgets and improves performance.

Getting Started #

Add EasyManager and your state class to Main:

example:

import 'package:easy/easy.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: MyApp()))
}

Create your business logic class by extending EasyBloc and store it in a variable. Automatically your IDE will prompt you to implement exec. Exec will immediately execute everything inside it, whether asynchronous or asynchronous. If you have asynchronous tasks, it will expect you to complete all tasks within the class, and then rebuild the views related to your class automatically.


final appBloc = AppBloc();
class AppBloc extends EasyBloc {
  int counter = 0;

  @override
  void exec() {
    counter++;
    super.exec();
  }
}

Use the Store widget. A magical widget that will identify any changes in your logical class, and rebuild the changed widget for you.

Important! In other state managers, you must enter ChangeNotifierProvider or another Provider as the parent of MaterialApp. With Easy this is not necessary. EasyManager just needs to be above the Store() widget anywhere in the widget tree.

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return EasyManager(
      bloc: appBloc,
      view: Scaffold(
          floatingActionButton: FloatingActionButton(
              child: Icon(Icons.add), onPressed: () => appBloc.exec()),
          body: Center(
            child: Store(rebuild:(_) => Text(
                "${appBloc.counter}",
                style: TextStyle(fontSize: 50),
              ),
            ),
          ),
        );
    )
  }
}

Ready! You created the default example that has more than 100 lines of code with only 30 lines, and still separated business logic from its UI. This is amazing!

If you navigate to another class, you can use the Store Widget to get the value of your logical class, as well as the Provider, and you can call dispose anytime you want using: variableName.dispose().

Full code example:

import 'package:easy/easy.dart';
import 'package:flutter/material.dart';

void main() {
 runApp(MaterialApp(home: MyApp()));
}

final appBloc = AppBloc();
class AppBloc extends EasyBloc {
 int counter = 0;

 @override
 void exec() {
  counter++;
  super.exec();
 }
}

class MyApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
  return EasyManager(
      bloc: appBloc,
      view: Scaffold(
       floatingActionButton: FloatingActionButton(
           child: Icon(Icons.add), onPressed: () => appBloc.exec()),
       body: Center(child: Store(rebuild:(_) => Text(
         "${appBloc.counter}",
         style: TextStyle(fontSize: 50),
        ),
        ),
       ),
      )
  );
 }
}

1.0.0 #

  • Initial release from Easy

1.0.1 #

  • Add example and clean

1.0.2 #

  • Update readme files

1.1.0 #

  • Add module widget

1.1.1 #

  • Removed unnecessary dependencies

1.1.2 #

  • Changed documentation

1.1.2+2 #

  • fix bugs

1.1.2+3 #

  • fix bugs

2.0.0 #

  • Improved performance by 140% (over RAM usage)
  • Code Cleanup
  • Integral refactoring of the code.

example/readme.md

Easy #

An easy Flutter state management that allows minimal rebuild of widgets and improves performance.

Getting Started #

Add EasyManager and your state class to Main:

example:

import 'package:easy/easy.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: MyApp()))
}

Create your business logic class by extending EasyBloc and store it in a variable. Automatically your IDE will prompt you to implement exec. Exec will immediately execute everything inside it, whether asynchronous or asynchronous. If you have asynchronous tasks, it will expect you to complete all tasks within the class, and then rebuild the views related to your class automatically.


final appBloc = AppBloc();
class AppBloc extends EasyBloc {
  int counter = 0;

  @override
  void exec() {
    counter++;
    super.exec();
  }
}

Use the Store widget. A magical widget that will identify any changes in your logical class, and rebuild the changed widget for you.

Important! In other state managers, you must enter ChangeNotifierProvider or another Provider as the parent of MaterialApp. With Easy this is not necessary. EasyManager just needs to be above the Store() widget anywhere in the widget tree.

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return EasyManager(
      bloc: appBloc,
      view: Scaffold(
          floatingActionButton: FloatingActionButton(
              child: Icon(Icons.add), onPressed: () => appBloc.exec()),
          body: Center(
            child: Store(rebuild:(_) => Text(
                "${appBloc.counter}",
                style: TextStyle(fontSize: 50),
              ),
            ),
          ),
        );
    )
  }
}

Ready! You created the default example that has more than 100 lines of code with only 30 lines, and still separated business logic from its UI. This is amazing!

If you navigate to another class, you can use the Store Widget to get the value of your logical class, as well as the Provider, and you can call dispose anytime you want using: variableName.dispose().

Use this package as a library

1. Depend on it

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


dependencies:
  easy: ^2.0.0+1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:easy/easy.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
77
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

Format lib/src/bloc.dart.

Run flutter format to format lib/src/bloc.dart.

Format lib/src/core.dart.

Run flutter format to format lib/src/core.dart.

Format lib/src/easy_bloc.dart.

Run flutter format to format lib/src/easy_bloc.dart.

Format lib/src/easy_manager.dart.

Run flutter format to format lib/src/easy_manager.dart.

Format lib/src/store.dart.

Run flutter format to format lib/src/store.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test