Design and Implementation of FairPushy: A Dart‑Based Dynamic Update Platform for Flutter

This article presents the architecture, technology choices, and practical implementation details of FairPushy—a Dart‑driven backend and Flutter dynamic‑update platform—covering server development, concurrency handling, ORM integration, automated build pipelines, and deployment strategies for seamless hot‑reloading of mobile applications.

58 Tech
58 Tech
58 Tech
Design and Implementation of FairPushy: A Dart‑Based Dynamic Update Platform for Flutter

FairPushy is a three‑platform (iOS, Android, Web) dynamic update solution built on Flutter and Dart, aiming to reduce initial package size, improve developer experience, and enable hot updates without releasing new app versions.

Flutter Dynamic Overview – Flutter allows a single codebase to run on multiple operating systems with native performance. While its cross‑platform benefits are well known, package size and dynamic update challenges remain, which FairPushy addresses by providing automated bundle packaging and distribution.

Technology Selection – The team evaluated several server‑side languages (Java, Node.js, Go, PHP, Python) and chose Dart because the same language can be used for both Flutter front‑end and backend services, eliminating language‑learning overhead and ensuring platform consistency.

FairPushy Architecture – The system consists of four major components: (1) Dart support (core libraries, isolates, concurrency), (2) Dart Server (database, ORM, RPC, HTTP APIs), (3) Flutter Web & Fair SDK (bundle packaging, upload, runtime loading), and (4) Operations & R&D support (shared logging, networking, crash and performance monitoring).

Dart Server Practice – Development involves configuring the Dart environment, using a custom server library that provides logging, routing, and widget‑style API definitions. Example route registration uses a ServerPages mixin with GetPage entries specifying name, page class, HTTP method, and authentication requirements.

mixin ServerPages {
  static final routes = [
    GetPage(
      name: Routes.GET_APP_PATCH,
      page: () => GetBundlePage(),
      method: Method.get,
      needAuth: false,
    ),
    GetPage(
      name: Routes.GET_PROJECT,
      page: () => GetProjectPage(),
      method: Method.post,
    ),
  ];
}

A typical service widget extends FairServiceWidget and implements an async service method that validates parameters, queries the database via an ORM PatchDao, and returns a JSON response.

class GetBundlePage extends FairServiceWidget {
  @override
  Future<ResponseBaseModel> service(Map? request_params) async {
    var bundleId = request_params?["bundleId"];
    if (bundleId == null || bundleId == "") {
      return ParamsError(msg: "bundleId==null");
    }
    var bundleList = [];
    await withTransaction<void>(() async {
      final dao = PatchDao();
      var rows = await dao.searchBundleId(bundleId);
      for (int i = 0; i < rows.length; i++) {
        bundleList.add(rows[i].toBundleJson());
      }
    }).catchError(((error, stack) {
      ResponseError(msg: error.toString());
    }));
    return ResponseSuccess(data: bundleList);
  }
}

Concurrency Model – Dart executes code in a single thread but supports concurrency through async/await and isolates. Each isolate has its own heap and event loop, allowing parallel execution without shared memory, thus avoiding traditional locking mechanisms.

Ecosystem Completion – To make Dart suitable for backend development, essential components such as database connection pools, logging, monitoring, and an ORM layer are built. The ORM maps relational tables to Dart objects, provides CRUD operations, and caches results to reduce database load.

class PatchDao extends Dao<Patch> {
  PatchDao() : super(tablename);
  static String get tablename => 'patch_info';
  @override
  Patch fromRow(Row row) => Patch.fromRow(row);
  Future<void> updateByPatch(Entity<Patch> entity) async {
    final fields = entity.fields;
    final values = convertToDb(entity.values);
    final sql = 'update patch_info set `${fields.join("`=?, `")}`=? where bundle_id=?';
    await db.query(sql, [...values, entity.id]);
  }
}

Online Compilation – Fair bundles (JSON & JS) are built on a Flutter Web platform. Two upload modes exist: manual upload of locally compiled artifacts, and automated upload triggered by a CI pipeline that clones the project repository, runs flutter pub get and flutter pub run build_runner build, then uploads the result to a CDN.

var shell = Shell();
await shell.cd('/opt/').run('''
  rm -rf $git_dir_path
  mkdir -p $git_dir_path
''');
await shell.cd(git_dir_path).run('''
  git clone $patchGitUrl ./
  git checkout $patchGitBranch
  flutter pub get
  flutter pub run build_runner build
''');

Conclusion & Outlook – The implementation demonstrates that Dart can serve as a viable backend language for Flutter‑centric ecosystems, offering unified codebases, reduced learning curves, and efficient hot‑update capabilities. The project is open‑source on GitHub, and further work includes expanding the ecosystem, improving performance, and enhancing monitoring.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendDARTFlutterDockerconcurrencyORMdynamic-update
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

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.