scoper 0.0.1+0 copy "scoper: ^0.0.1+0" to clipboard
scoper: ^0.0.1+0 copied to clipboard

outdated

A minimal state management solution for Flutter.

Scoper #

A minimal state management solution for Flutter. #


How to use: #

Create scope class by extending Scope. Use update() to trigger a rebuild of ScopeBuilder<ExampleScope>.

class CounterScope extends Scope {
  int _counter = 0;

  increment() {
    _counter++;
    update();
  }

  get counter => _counter;
}

Register scope-instances by passing them to a ScopeRegistrant at the root of the widget-tree.

ScopeRegistrant(
    scopes: [
        CounterScope(),
        ExampleScope(),
    ],
    child: Container(),
)

Use a ScopeBuilder<ExampleScope> to build widgets depending on a given scope.

ScopeBuilder<CounterScope>(
    builder: (context, scope) {
        return Text(scope.counter.toString());
    },
),

Use get<ExampleScope> to get a scope from context and call it's methods (for example in onPressed).

context.get<CounterScope>().increment(),

Open for contribution and feedback! 😄

4
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A minimal state management solution for Flutter.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on scoper