osam 6.2.3 copy "osam: ^6.2.3" to clipboard
osam: ^6.2.3 copied to clipboard

discontinued
outdated

Lightweight and predictable state management

example/lib/main.dart

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

class Counter {
  Counter([this._value]) {
    _value ??= PropertyNotifier(0);
  }

  PropertyNotifier<int> _value;

  IProperty<int> get value => _value;

  void increment() => _value.value++;
}

void main() {
  final counter = Counter();
  runApp(Example(counter: counter));
}

class Example extends StatelessWidget {
  final Counter counter;

  const Example({Key key, this.counter}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        floatingActionButton: FloatingActionButton(
          child: Icon(Icons.add),
          onPressed: () => counter.increment(),
        ),
        body: Center(
          child: ValueListenableBuilder(
            valueListenable: counter.value,
            builder: (_, value, __) => Text(
              value.toString(),
              style: const TextStyle(fontSize: 40),
            ),
          ),
        ),
      ),
    );
  }
}
9
likes
0
points
15
downloads

Publisher

verified publisherrenesanse.net

Weekly Downloads

Lightweight and predictable state management

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

equatable, flutter, hive, path_provider

More

Packages that depend on osam