firebase_service

Last updated:

0 purchases

firebase_service Image
firebase_service Images
Add to Cart

Description:

firebase service

This package includes FirestoreService, a wrapper class for the cloud_firestore APIs.
FirestoreService uses generics and the builder pattern to provide a type-based abstraction on top of cloud_firestore.
It covers only a very limited subset of APIs from cloud_firestore.
Getting started #
In your flutter project add the dependency:
dependencies:
firebase_service: ^<version>
copied to clipboard
Import package:
import 'package:firebase_service/firebase_service.dart';
copied to clipboard
Usage #
Create instance:
final service = FirestoreService.instance;
copied to clipboard
To write a document:
final path = 'collection/$id';
await service.set(path: path, data: {'id': id});
copied to clipboard
To update a document:
final path = 'collection/$id';
await service.update(path: path, data: {'id': id});
copied to clipboard
To delete a document:
final path = 'collection/$id';
await service.delete(path: path);
copied to clipboard
To get a document:
final path = 'collection/$id';
final res = await service.getDocument(
path: path,
builder: ((data, documentID) => data!),
);
copied to clipboard
To stream a document:
final path = 'collection/$id';
final res = service.documentStream(
path: path,
builder: ((data, documentID) => data!),
);
copied to clipboard
To stream a collection:
final path = 'collection/$id';
final res = service.collectionStream(
path: path,
builder: ((data, documentID) => data!),
);
copied to clipboard
To get a collection:
final path = 'collection/$id';
final res = await service.getCollection(
path: path,
builder: ((data, documentID) => data!),
);
copied to clipboard
To get a collection with limit:
final path = 'collection/$id';
final res = service.collectionStream(
path: path,
builder: ((data, documentID) => data!),
limit: 20, //* <--- Just add a limit.
);
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.