Mobile — Flutter

Backends

Swap your backend without rewriting your app — REST and Firebase both sit behind the same datasource contract.

Infrastructure

Swap your backend without rewriting your app

REST / Dio — Dio Client DatasourceSends and receives JSON data from a REST API, using one shared, reusable HTTP client.
Firebase — Cloud Firestore DatasourceReads and writes data directly to Firestore, without your business logic needing to know it's there.
// counter_controller.dart
@riverpod
CounterRemoteDatasource counterRemoteDatasource(
  Ref ref,
) {
  // REST / Dio
  return CounterRestDatasource(
    ref.watch(baseApiClientProvider),
  );

  // Firebase / Firestore
  // return CounterFirebaseDatasource(
  //   FirebaseFirestore.instance,
  // );
}

You don't need to change your business logic. Your data models, repository rules, and screens stay exactly the same no matter which backend you choose.