Skip to content

yuriusuonly/xyz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XYZ

Tests

Dart reactive state component inspired by popular state management libraries.

  • Allows surgical/fine-grained UI updates in-sync with the data.
  • Leveraging the use of Streams for Asynchronous data flows.
  • ~100 lines of code minimizing large dependency maintenance.

Usage

Import the package repository as dependency:

# pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
  # ...
  xyz:
    git:
      url: https://github.com/yuriusuonly/xyz
  # ...

Example

Check the demos for sample data flow use cases.

// lib/main.dart
import 'package:flutter/material.dart';
import 'package:xyz/xyz.dart';

void main() => runApp(App());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Builder(
        builder: (context) => XYZ(() {
          final counter = 0.state(); // Initialize the counter state.
          return Scaffold(
            body: Center(
              child: Text('${counter.value}') // Render the counter state value.
            ),
            floatingActionButton: FloatingActionButton.extended(
              onPressed: () => counter.value++, // Update the counter state value.
              label: const Text('Increase')
            )
          );
        })
      )
    );
  }
}

See also

About

Simplified reactive state component for Dart/Flutter.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages