pkozlovskiy / brick_cloud_firestore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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


Languages

Language:Dart 100.0%