sumibi 1.0.0

  • Readme
  • Changelog
  • Installing
  • 48

Sumibi #

sumibi_logo

Sumibi is thin could_firestore wrapper.

Sumibi can inject your own hooks on calling of setData/set and updateData/update.

Usage #

final sumibi = SumibiFirestore(
  Firestore.instance,
  onSetDataHook: (String documentPath, Map<String, dynamic> data) {
    data["createdAt"] = FieldValue.serverTimestamp();
    data["updatedAt"] = FieldValue.serverTimestamp();
  },
  onUpdateDataHook: (String documentPath, Map<String, dynamic> data) {
    data["updatedAt"] = FieldValue.serverTimestamp();
  },
);


// Now `user` have properties `name`, `createdAt` and `updatedAt`.
final user = await sumibi.collection("/users").add({"name": "John"});

// Now `user.name` will be "May" and `user.updatedAt` will be updated. 
await user.updateData({"name": "May"});



final friends = user.collection("/friends");
await sumibi.batch()
  // Also `createdAt` and `updatedAt` will be created.
  ..setData(friends.document("/a"), {"name": "Alex"})
  ..setData(friends.document("/b"), {"name": "Bob"})
  // `user.updatedAt` will be updated.
  ..updateData(user, {"numOfFriends": 2})
  ..commit();



sumibi.runTransaction((transaction) {
  // After this transaction, `user.updatedAt` will be updated.
  transaction.update(user, {"likeCount": FieldValue.increment(1)});
});

SumibiFirestore implements Firestore class of could_firestore. So you can use the instance of SumibiFirestore as Firestore.

[1.0.0] #

  • First release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  sumibi: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:sumibi/sumibi.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:sumibi/sumibi.dart that imports:
  • package:firebase_core/firebase_core.dart that declares support for platforms: android, ios, macos, web

Package does not support Flutter platform windows

Because:

  • package:sumibi/sumibi.dart that imports:
  • package:firebase_core/firebase_core.dart that declares support for platforms: android, ios, macos, web

Package not compatible with SDK dart

Because:

  • sumibi that is a package requiring null.

Health suggestions

Format lib/src/collection_reference.dart.

Run flutter format to format lib/src/collection_reference.dart.

Format lib/src/hook.dart.

Run flutter format to format lib/src/hook.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and sumibi.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.8.1 <3.0.0
cloud_firestore ^0.13.5 0.13.7
firebase_core ^0.4.4+3 0.4.5
flutter 0.0.0
Transitive dependencies
charcode 1.1.3
cloud_firestore_platform_interface 1.1.2
cloud_firestore_web 0.1.1+2
collection 1.14.12 1.14.13
firebase 7.3.0
firebase_core_platform_interface 1.0.4
firebase_core_web 0.1.1+2
flutter_web_plugins 0.0.0
http 0.12.1
http_parser 3.1.4
js 0.6.2
matcher 0.12.8
meta 1.1.8 1.2.2
path 1.7.0
plugin_platform_interface 1.0.2
quiver 2.1.3
sky_engine 0.0.99
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test
mockito ^4.1.1
pedantic ^1.9.0 1.9.0 1.9.2