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

Lightweight reactive value holders for Flutter with linked values, notifications, timing controls, and builder widgets.

example/main.dart

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

void main() => runApp(const HoldersExample());

class HoldersExample extends StatefulWidget {
  const HoldersExample({super.key});

  @override
  State<HoldersExample> createState() => _HoldersExampleState();
}

class _HoldersExampleState extends State<HoldersExample> {
  final counter = ValueHolder<int>(0, isEqual: nativeIsEqual);

  @override
  void dispose() {
    counter.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Holders example')),
        body: Center(
          child: HolderBuilder(
            holder: counter,
            builder: (context) => Text(
              '${counter.value}',
              style: Theme.of(context).textTheme.displayLarge,
            ),
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () => counter.value++,
          child: const Icon(Icons.add),
        ),
      ),
    );
  }
}
1
likes
160
points
107
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Lightweight reactive value holders for Flutter with linked values, notifications, timing controls, and builder widgets.

Repository (GitHub)
View/report issues

Topics

#state-management #reactive #value-notifier #value-listenable #flutter

License

MIT (license)

Dependencies

flutter

More

Packages that depend on holders