easy 2.0.0 copy "easy: ^2.0.0" to clipboard
easy: ^2.0.0 copied to clipboard

outdated

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

example/lib/main.dart

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

class AppWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        navigatorKey: Get.key,
        home: EasyManager(
          view: HomeModule(),
          bloc: counterBloc,
        ));
  }
}

class HomeModule extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton:
          FloatingActionButton(onPressed: () => counterBloc.exec()),
      appBar: AppBar(
        title: Text("test easy"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Store(rebuild: (_) => Text("${counterBloc.count}")),
            FlatButton(
              onPressed: () => Get.to(HomeModule2()),
              child: Text("Next"),
              color: Colors.amber,
            )
          ],
        ),
      ),
    );
  }
}

class HomeModule2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton:
          FloatingActionButton(onPressed: () => counterBloc.exec()),
      appBar: AppBar(
        title: Text("test easy 2"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Store(rebuild: (_) => Text(counterBloc.count.toString())),
            FlatButton(
              onPressed: () => Get.back(),
              child: Text("done"),
              color: Colors.amber,
            ),
            FlatButton(
              onPressed: () => counterBloc.dispose(),
              child: Text("dispose"),
              color: Colors.amber,
            ),
          ],
        ),
      ),
    );
  }
}

final HomeBloc counterBloc = HomeBloc();
class HomeBloc extends EasyBloc {
  int count = 0;

  @override
  void exec() {
    count++;
    super.exec();
  }
}
19
likes
0
pub points
26%
popularity

Publisher

verified publishergetx.site

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on easy