dataflow 1.2.0 copy "dataflow: ^1.2.0" to clipboard
dataflow: ^1.2.0 copied to clipboard

A reactive state management library for Flutter with a simple and intuitive API which allows you to build Flutter applications with ease.

example/lib/main.dart

// main.dart
import 'package:dataflow/dataflow.dart';
import 'package:example/store.dart';
import 'package:flutter/material.dart';

import 'actions.dart';
import 'login_widget.dart';
import 'todo_widget.dart';

void main() {
  final store = AppStore();
  DataFlow.init(store);
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Login and Todo App')),
        body: DataSync<AppStore>(
          useDefaultWidgets: true,
          actionNotifier: {
            LoginAction: (context, action, status) {
              if (status == DataActionStatus.error) {
                ScaffoldMessenger.of(context).showSnackBar(
                  SnackBar(
                    content: Text(action.error),
                  ),
                );
              }
            },
          },
          builder: (context, store, hasData) {
            return store.isLoggedIn ? TodoScreen() : LoginScreen();
          },
          actions: const {LoginAction},
        ),
      ),
    );
  }
}
11
likes
0
points
107
downloads

Publisher

verified publishercodepur.dev

Weekly Downloads

A reactive state management library for Flutter with a simple and intuitive API which allows you to build Flutter applications with ease.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

flutter, rxdart

More

Packages that depend on dataflow