0 purchases
property
Property #
[Property] is a solution when you need easy support for updating widgets values without setState using streams
Usage #
import 'package:property/property.dart';
final Property<int> _counter = Property(0);
void _incrementCounter() {
_counter.value++;
}
Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
PropertyBuilder(
property: _counter,
builder: (context, value) => Text(
value.toString(),
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
copied to clipboard
Example project #
Example usage in /example folder.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.