data_store_impl 0.0.2 copy "data_store_impl: ^0.0.2" to clipboard
data_store_impl: ^0.0.2 copied to clipboard

A package that provide local and online data storage implementations, and synchronization options.

Data Store #

A package that provides local and online data storage implementations, and synchronization options.

Features #

  • Local data storage using Localstore
  • Online data storage using Firestore
  • Synchronization between local and online data stores
  • Error handling for both Localstore and Firestore operations

Getting Started #

To start using the `` package, add it to your pubspec.yaml file:

dependencies:
  : latest

Then, run flutter pub get to install the package.

Usage #

Creating a Document #

To create a new document in a collection:

import 'package:/.dart';

void main() async {
  final data = {'name': 'John Doe', 'age': 30};
  final documentId = await DataStoreHelpers.createDocument('users', data);
  print('Document created with ID: $documentId');
}

Updating a Document #

To update an existing document:

import 'package:/.dart';

void main() async {
  final data = {'name': 'Jane Doe', 'age': 25};
  await DataStoreHelpers.updateDocument('users', 'documentId', data);
  print('Document updated');
}

Deleting a Document #

To delete a document:

import 'package:/.dart';

void main() async {
  await DataStoreHelpers.deleteDocument('users', 'documentId');
  print('Document deleted');
}

Error Handling #

The package provides error handling for both Localstore and Firestore operations. For example, to handle errors when creating a document:

import 'package:/.dart';

void main() async {
  try {
    final data = {'name': 'John Doe', 'age': 30};
    final documentId = await DataStoreHelpers.createDocument('users', data);
    print('Document created with ID: $documentId');
  } catch (e) {
    print('Error: $e');
  }
}

Additional Information #

For more information, visit the GitHub repository.

To contribute to the package, please open an issue or submit a pull request on the issue tracker.

License #

This package is licensed under the MIT License. See the LICENSE file for more information.

0
likes
130
points
36
downloads

Publisher

verified publishertheresilient.dev

Weekly Downloads

A package that provide local and online data storage implementations, and synchronization options.

Documentation

API reference

License

MIT (license)

Dependencies

cloud_firestore, firebase_core, flutter, localstore

More

Packages that depend on data_store_impl