Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 672 Bytes

useUpdate.md

File metadata and controls

33 lines (26 loc) · 672 Bytes

useUpdate

Flutter utility hook that returns a function that forces component to re-build when called.

Installation

dependencies:
  flutter_use: ^0.0.2

Usage

class Sample extends HookWidget {
  @override
  Widget build(BuildContext context) {
    final update = useUpdate();

    return Column(
      children: [
        Text("Now: ${DateTime.now()}"),
        ElevatedButton(
          onPressed: () => update(),
          child: const Text("Update"),
        ),
      ]
    );
  }
}