bolter_flutter 6.6.4 copy "bolter_flutter: ^6.6.4" to clipboard
bolter_flutter: ^6.6.4 copied to clipboard

discontinuedreplaced by: bolter
outdated

based on bolter library extensions for manage widgets and state

example/lib/main.dart

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

class MyPresenter extends Presenter<MyPresenter> {

  late final b = BolterProvider.of(context);

  void initState(){
    b.hashCode;
  }

  var _value = 0;

  void increment() {
    runAndUpdate(action: () {
      _value++;
    });
  }

  ValueStream<int> get valueStream => stream(() => _value);
}

void main() async {
  runApp(
    BolterProvider(
      container: DependenciesContainer(),
      child: PresenterProvider(
        presenter: MyPresenter(),
        child: Builder(
          builder: (ctx) {
            return MaterialApp(
              home: Scaffold(
                body: Center(
                  child: Column(
                    children: [
                      ValueStreamBuilder(
                        stream: ctx.presenter<MyPresenter>().valueStream,
                        builder: (BuildContext context, int value) {
                          return Text(value.toString());
                        },
                      ),
                      Padding(
                        padding: EdgeInsets.only(top: 16),
                        child: ElevatedButton(
                          child: Text("Increment"),
                          onPressed: () {
                            ctx.presenter<MyPresenter>().increment();
                          },
                        ),
                      )
                    ],
                  ),
                ),
              ),
            );
          },
        ),
      ),
    ),
  );
}
4
likes
0
pub points
0%
popularity

Publisher

verified publisherrenesanse.net

based on bolter library extensions for manage widgets and state

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

bolter, dependencies_container, flutter

More

Packages that depend on bolter_flutter