A new Flutter package.


This library is aimed at separating the logic of drawing a widget and changing its state. Please look at the example in the project.

Use StatefulWidget as a constructor, the widget is passed to the controller. A big request to use the methods of the life cycle controller.



'onCreate' called when creating a controller in 'initState()' of your state.

'onWidgetUpdate' called after changing the widget and before the method 'build()' of your state.

'onDispose' called when the 'dispose()' of your state.

'changeState' this method calls 'setState()' in itself, and therefore requires the same parameters.


ControllerInjector is an mixin. For the status link and the controller, you must specify YourState with ControllerInjector and override method createStateController().


class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage>
    with ControllerInjector<MyHomePage, _MyHomePageController> {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      body: Center(
        child: Column(
          children: <Widget>[
              'You have pushed the button this many times:',
              style: Theme.of(context).textTheme.display1,
      floatingActionButton: FloatingActionButton(
        onPressed: controller.increment,
        tooltip: 'Increment',
        child: Icon(Icons.add),

  _MyHomePageController createStateController() => _MyHomePageController();

class _MyHomePageController extends StateController<MyHomePage> {
  int _counter = 0;
  int get counter => _counter;

  void increment() {
    changeState(() {


Copyright 2018 Miolin Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.