Mobile Development 7 min read

Fair 2.0: Features, Usage Guide, and Roadmap for the Flutter Dynamic Framework

This article introduces Fair 2.0—a dynamic framework for Flutter—detailing its new features, installation steps, code examples for loading bundles, model registration, and runtime error handling, followed by contributor information, upcoming roadmap items, and links to documentation and source repositories.

58 Tech
58 Tech
58 Tech
Fair 2.0: Features, Usage Guide, and Roadmap for the Flutter Dynamic Framework

Fair 2.0 Feature Overview

Fair is a dynamic framework designed for Flutter that enables hot updates of widget trees and state without releasing a new app version. Fair 2.0 addresses the limited logic dynamism of Fair 1.0.

Version Features (2.6.0)

Supports loading bundle files from mobile device paths.

Compatible with Flutter SDK 2.10.0‑2.10.3.

Dart2JS can parse static methods.

Improved runtime error messages with clickable error icons that show logs.

Sugar syntax now supports parsing Model data.

Model Usage Example

Step 1: Define a model that implements BaseModel and provides toJson and a from method.

import 'package:fair/src/render/base_model.dart';

class Person implements BaseModel {}

Step 2: Register the model in a GeneratedModule implementation.

class TestGeneratedModule implements GeneratedModule {
  // register model here
}

Step 3: Use the model with Sugar.mapEach :

Sugar.mapEach([Person(name: "kk", age: 18, wei: 99)], (index, Person item) {
  // use item.name, item.age, etc.
});

Quick Integration

Add Fair dependencies to pubspec.yaml :

# add Fair dependency
dependencies:
  fair: 2.6.0

# add compiler dependency
dev_dependencies:
  build_runner: ^2.0.0
  fair_compiler:
    path: ../fair/compiler

# override version according to local Flutter SDK
dependency_overrides:
  fair_version: 2.0.6+1

Initialize Fair in the app entry point:

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

Contributors & Resources

Fair’s open‑source repository: https://github.com/wuba/fair

Official website: https://fair.58.com

Flutter dynamic framework documentation and tutorials.

Design and implementation articles (e.g., logic dynamization, DSL generation, hot‑update design).

Case studies such as integration in 58 Tongcheng and Anju Paifang apps.

Roadmap (2022)

Null‑safe support (April 2022) – ✅

Flutter 2.8.0 adaptation (mid‑May) – ✅

Flutter 2.10.0 adaptation (early June) – ✅

IDE syntax checking plugin – ✅

Rich syntax sugar extensions.

Hot‑update platform based on Dart Server and Flutter Web.

Online low‑code editing tools for dynamic page creation.

Community

Developers are encouraged to submit issues, pull requests, and join the WeChat group for support.

GitHub address: https://fair.58.com

Fair official site: https://fair.58.com

DartFlutterhot reloadframeworkmobile-developmentDynamic UpdatesFAIR
58 Tech
Written by

58 Tech

Official tech channel of 58, a platform for tech innovation, sharing, and communication.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.