flow 0.1.0 copy "flow: ^0.1.0" to clipboard
flow: ^0.1.0 copied to clipboard

discontinued

Functional listener/observable widgets (FLOWs). Propagate your state changes using stream controller broadcasts.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flow/flow.dart';

final Map flows = {
  'tapCount': FLOW().stream(0),
};

final FLOW myHomePage = FLOW(
  ctl: flows['tapCount'],
  cnd: (val) => val % 2 == 0,
  builder: ({ctx, val}) => Scaffold(
        appBar: AppBar(
          title: Text(
            val == 0 ? 'Hello world!' : 'The tap count is EVEN ($val)',
          ),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              FLOW(
                ctl: flows['tapCount'],
                builder: ({val, ctx}) => Text(
                      val == 0
                          ? 'Press the plus button to begin!'
                          : 'Total Taps: $val',
                    ),
              ),
            ],
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            flows['tapCount'].current(flows['tapCount'].val + 1);
          },
          tooltip: 'Increment',
          child: Icon(Icons.add),
        ),
      ),
);

final FLOW myApp = FLOW(
  builder: ({ctx, val}) => MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: myHomePage,
      ),
);

void main() => runApp(myApp);
0
likes
20
pub points
6%
popularity

Publisher

unverified uploader

Functional listener/observable widgets (FLOWs). Propagate your state changes using stream controller broadcasts.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flow