Skip to content

jnhuynh/brick_cloud_firestore

Repository files navigation

Brick Cloud Firestore

A package that provides a Brick compatible Cloud Firestore provider, repository, and code generation.

Brick Cloud Firestore is still in a pre-alpha release

Packages

ConnectOfflineFirstWithCloudFirestore

@ConnectOfflineFirstWithCloudFirestore combines a sqlite cache, via Brick Offline First, and Cloud Firestore. By leveraging this annotation, we benefit from code generation that will build adapters for both data sources and DB schema migrations.

Setup

  1. Add the following packages:
brick_cloud_firestore:
  git:
    url: https://github.com/jnhuynh/brick_cloud_firestore.git
    path: packages/brick_cloud_firestore
brick_offline_first: any

dev_dependencies:
  build_runner: any
  brick_offline_first_with_cloud_firestore_build:
    git:
      url: https://github.com/jnhuynh/brick_cloud_firestore.git
      path: packages/brick_offline_first_with_cloud_firestore_build
$ flutter pub get
  1. Create an annotated model
import 'package:brick_cloud_firestore/cloud_firestore.dart';

@ConnectOfflineFirstWithCloudFirestore()
class Customer extends OfflineFirstWithCloudFirestoreModel {
  final String firstName;
  final String lastName;

  Customer({
    this.firstName,
    this.lastName,
  });
}
  1. Generate adapters and migrations.
$ flutter pub run build_runner build

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages