Popsiclev2.1.0
GitHub ↗
Popsicle docs · 2.1.0

Getting Started

Start using Popsicle with the four declaration APIs and UI projection.

Getting Started

import 'package:popsicle/popsicle.dart';

Wrap the app:

runApp(
  const Popsicle(
    child: MyApp(),
  ),
);

The four recommended declarations are:

Popsicle.inject(...)
Popsicle.value(...)
Popsicle.create(...)
Popsicle.params(...)

Example:

final api = Popsicle.inject((_) => ApiClient());
final count = Popsicle.value(0);
final counter = Popsicle.create((_) => CounterStore());

Store:

class CounterStore extends Store<int> {
  CounterStore() : super(0);

  void increment() => commit(state + 1);
}

Render small state:

count.ui((value) => Text('$value'));

Render Store state:

counter.ui(
  (context, state, store) => Text('$state'),
);