bolter_flutter 7.0.1 icon indicating copy to clipboard operation
bolter_flutter: ^7.0.1 copied to clipboard

based on bolter library extensions for manage widgets updates

example/lib/main.dart

import 'package:bolter_flutter/bolter_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      home: PresenterProvider(
        presenter: ExamplePresenter(),
        builder: (ctx) {
          print(ctx.presenter<ExamplePresenter>());
          return const Example();
        },
      ),
    ),
  );
}

class ExamplePresenter extends Presenter<ExamplePresenter> {
  var _counter = 0;

  int get counter => _counter;

  void onIncrementTap() => perform(action: () => _counter++);
}

class Example extends StatelessWidget {
  const Example({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final presenter = context.presenter<ExamplePresenter>();
    return SyncBuilder.getter(
      getter: () => presenter.counter,
      builder: (context, snapshot) {
        return CupertinoButton(
          onPressed: presenter.onIncrementTap,
          child: Text(snapshot.toString()),
        );
      },
    );
  }
}
4
likes
120
pub points
47%
popularity

Publisher

verified publisher iconrenesanse.net

based on bolter library extensions for manage widgets updates

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

bolter, flutter

More

Packages that depend on bolter_flutter