Fair is a lightweight package for Flutter, which can be used to update widget tree and state dynamically. This package is still at an early stage.
We create Fair so we can dispatch any pages changes to users as bundle(s), the way similar to React Native. With Flutter Fair integrated, you can publish your pages without waiting for the next release date of your App. Fair provides standard widget and some logic plugins, it can be used as a new dynamic page or as part of existing Flutter page.
Use Flutter Fair require few steps.
step1:download fair project source code
It is recommended to download fair to the local and dependencies on the relative path.
The download method is as follows:
git clone https://github.com/wuba/fair.git
step2:Add dependency inside pubspec.yaml
Assuming that the fair project and your own project are in the same folder:
# add Fair dependency
dependencies:
fair:
path: ../fair/fair
# add compiler dependency
dev_dependencies:
build_runner: ^1.4.0
fair_compiler:
path: ../fair/compiler
# switch "fair_version" according to the local Flutter SDK version
dependency_overrides:
fair_version:
path: ../fair/flutter_version/flutter_2_0_6
step3:Wrap your app with FairApp Widget
void main() {
WidgetsFlutterBinding.ensureInitialized();
FairApp.runApplication(
_getApp(),
plugins: {
},
);
}
dynamic _getApp() => FairApp(
modules: {
},
delegate: {
},
child: MaterialApp(
home: FairWidget(
name: 'DynamicWidget',
path: 'assets/bundle/lib_src_page_dynamic_widget.fair.json',
data: {"fairProps": json.encode({})}),
),
);
step4:Import a dynamic widget as FairWidget
FairWidget(
name: 'DynamicWidget',
path: 'assets/bundle/lib_src_page_dynamic_widget.fair.json',
data: {"fairProps": json.encode({})}),
For more details, please refer to https://fair.58.com
The simplest way to show us your support is by giving the project a star.