flutter_fc 0.0.2 copy "flutter_fc: ^0.0.2" to clipboard
flutter_fc: ^0.0.2 copied to clipboard

outdated

Writing Function Component in Flutter, just as writing in React.

() => Text("FC in Flutter") #

Pub Version

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.

3
likes
0
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

Writing Function Component in Flutter, just as writing in React.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_fc