FAIR

FAIR

Flutter dynamic whole process solution

Get Started 💡Github

Lightweight

The core runtime is only 2.6K lines of code, light in size and no trouble in size

low intrusion

Overall PUB dependency, just a few lines of code, FAIR runs instantly

easy to extend

Pluggable components, an annotation to fix business components and community UI library, expand your imagination

more flexible

Through a Flutter source code, dynamic & native flexible conversion, the cost is infinitely small

Flutter fully adapted

Constantly updated Fair-Version, compatible with most Flutter versions, no version anxiety

Hot Update Platform

A complete hot update platform, one-click deployment to anywhere

IDE Plugin

IDE supporting plug-in, real-time monitoring of your Flutter-FAIR syntax, one-click replacement when encountering problems

Online Platform

Enjoy the super experience brought to you by Flutter-FAIR anytime, anywhere


Get Started

Use Flutter Fair require few steps.

step1:download fair project source code

It is recommended to download fairopen in new window 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: 3.0.0

# add build_runner and compiler dependency
dev_dependencies:
  build_runner: ^2.0.0
  fair_compiler: ^1.4.0
 
# switch "fair_version" according to the local Flutter SDK version
# Flutter SDK 3.3.x(3.3.0、3.3.1、3.3.2、3.3.3、3.3.4、3.3.5、3.3.6) -> flutter_3_3_0
# Flutter SDK 3.0.x(3.0.0、3.0.1、3.0.2、3.0.3、3.0.4、3.0.5) -> flutter_3_0_0
# Flutter SDK 2.10.x(2.10.0、2.10.1、2.10.2、2.10.3) -> flutter_2_10_0
# Flutter SDK 2.8.x(2.8.0、2.8.1) -> flutter_2_8_0
# Flutter SDK 2.5.x(2.5.0、2.5.1、2.5.2、2.5.3) -> flutter_2_5_0
# Flutter SDK 2.0.6 -> flutter_2_0_6
# Flutter SDK 1.22.6 -> flutter_1_22_6
dependency_overrides:
  fair_version:
    path: ../fair/flutter_version/flutter_3_3_0

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({})}),

According to different scene demands, FairWidget can be mixed and used

  1. Can be mixed as different components
  2. Generally as a full screen page
  3. Support nested use, that is, it can be partially nested under a normal Widget, or it can be nested under another FairWidget

For related example details, please see the exampleopen in new window code