qbcps_flutter 0.1.0

qbcps_flutter #

A collection of utility classes that I wind up using in multiple projects.

None of these is particularly complicated, but in the interest of reuse I put them in this library rather than copy them all over the place.

Probably the class with the most utility for other folks is MapDB, which is just a map-backed database, as the name suggests. I wrote it as a stand-in for Firebase so I could do offline development, and it comes in handy for writing test cases.

[0.1.0] - 2019.06.17

BREAKING CHANGE

  • Changed CircularArray to be an Iterable issue #7
  • Changed the layout of the files in the project and changed the project to be pure Dart and not depend on Flutter. issue #8

[0.0.4] - 2019.06.13

[0.0.3] - 2019.06.04

  • Added CircularArray
  • Added NotificationManager

[0.0.2] - 2019.06.04

  • Added documentation comments to MapDB.

[0.0.1] - 2019.06.03

  • Initial release, with two classes: MapDB, an in-memory database that acts a bit like Firebase, and AccumulatorStream, a stream that performs a transformation on a collection of futures and fires an event when they're all done.

example/qbcps_flutter_example.dart

import 'package:qbcps_flutter/qbcps_flutter.dart';
import 'package:tuple/tuple.dart';

/// Example code showing how to use [MapDB]

void main() {
  MapDB<String, String> stringDatabase = MapDB<String, String>();

  stringDatabase.getChangeStream().listen((Tuple2<String, String> data) {
    print(
        "Change stream just reported that key: ${data.item1} was assigned value: ${data.item2}");
  });

  stringDatabase.getChangesForKey("A_Key").listen((String value) {
    print("Change stream for key `A_Key` reports value: $value");
  });

  String oldValue = stringDatabase.put("A_Key", "A_value");
  print("The freshly created MapDB contained $oldValue for key 'A_Key'");

  String freshlySetValue = stringDatabase.get("A_Key");
  print("Fetched value $freshlySetValue for key 'A_Key'");

  // both change streams will emit a data event for this
  stringDatabase.put("A_Key", "A_second_value");

  // only the database change stream (not the change stream for key 'A_Key') will emit data for this
  stringDatabase.put("B_Key", "B_value");

  stringDatabase.delete('A_Key');
}

Use this package as a library

1. Depend on it

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


dependencies:
  qbcps_flutter: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:qbcps_flutter/qbcps_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
29
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Sep 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:qbcps_flutter/qbcps_flutter.dart.

Health suggestions

Format lib/qbcps_flutter.dart.

Run dartfmt to format lib/qbcps_flutter.dart.

Format lib/src/circular_array.dart.

Run dartfmt to format lib/src/circular_array.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
tuple ^1.0.2 1.0.2
Transitive dependencies
matcher 0.12.5
meta 1.1.7
path 1.6.4
quiver 2.0.5
stack_trace 1.9.3
Dev dependencies
pedantic ^1.0.0
test ^1.5.0