flutter_fc 0.0.2
flutter_fc: ^0.0.2 copied to clipboard
Writing Function Component in Flutter, just as writing in React.
() => Text("FC in Flutter") #
An easy way to create Functional Components (FC) in Flutter.
The FC is in development.
Install #
For destructing records type. Dart 3 or greater version is required.
# ensure dart version >= 3
environment:
sdk: '^3.0.0'
dependencies:
flutter_fc: <latest version>
Equip Powerful Hooks #
Currently supports these hooks as following:
- useState
- useEffect
- useMemo
- useRef
Define a Counter FC #
final Counter = defineFC((props) {
final (counter, setCounter) = useState(0);
return ElevatedButton(
onPressed: () => setCounter(counter + 1),
child: Text("Counter: $counter"),
);
});
Lint #
To avoid IDE lint warnings, include FC preset.
# analysis_options.yaml
include: package:flutter_fc/lints.yaml
or configure manually.
linter:
rules:
non_constant_identifier_names: false
Acknowledgement #
React
Dart 3
License #
MIT (c) 2023-present, Luo3House.