brick_core 0.0.3+1

  • Readme
  • Changelog
  • Installing
  • new68

Brick Core #

Interfaces and shared helpers for implementing models, adapters, providers, and repositories in Brick.

Principles #

Brick's architecture encourages using data through a single access point: the repository.

Data flow with a single provider

A repository may implement multiple providers, but after instantiation the end application is only aware of the repository. The stream of data follows one course through each provider:

Data flow with many providers

The repository is aware of provider(s), the provider(s) are aware of the adapters, the adapters are aware of models, and the models are aware of only themselves. From the reverse, models are unaware, adapters are unaware of providers and providers are unaware of repositories.

Awareness

Because models are atomic and unaware, they don't rely on (de)serializing functions (unlike with JSON serializable). Brick reduces the concerns of the end-implementation by hiding (de)serializing and fetching logic into adapters, which translate raw data between providers:

Adapters

Unreleased #

0.0.3+1 #

  • Moves generator placeholders to FieldSerializable form OfflineFirst
  • Removes query validation that ensures all Where conditions have a non-null value

0.0.3 #

  • Add And and Or Where subclasses
  • Removes Type argument from Where
  • Adds semantic methods to Where such as isExactly and
  • BREAKING Revise Where syntax. This removes the second positional argument in favor of using it in a semantic method.
  • Adds Where.exact factory to preserve previous, short syntax
  • Move query-related files to src/query and make them accessible from a barrel file in the lib root

0.0.2 #

  • Fix linter hints
  • Adds initialize method to ModelRepository. This is enforces a predictable, overridable method for sub classes

Use this package as a library

1. Depend on it

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


dependencies:
  brick_core: ^0.0.3+1

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:brick_core/core.dart';
import 'package:brick_core/field_serializable.dart';
import 'package:brick_core/query.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/src/query/where.dart. (-0.50 points)

Analysis of lib/src/query/where.dart reported 1 hint:

line 98 col 27: Avoid const keyword.

Format lib/src/model_repository.dart.

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

Format lib/src/provider.dart.

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

Format lib/src/query/query.dart.

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

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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 brick_core.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
collection >=1.14.11 <2.0.0 1.14.12
Dev dependencies
dart_style ^1.2.4
mockito ^4.0.0
test >=1.9.4 <2.0.0