Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
frank06 committed Apr 26, 2024
1 parent a5b86c7 commit 4f531ce
Show file tree
Hide file tree
Showing 20 changed files with 217 additions and 201 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ coverage_badge.svg
.pub/
build/
tmp/
download/
download/

.vscode/launch.json
example/.vscode/launch.json
19 changes: 0 additions & 19 deletions .vscode/launch.json

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [2.0.0-rc2] - April 24th, 2024

- New version based on `sqlite3`

## [1.5.14] - September 22nd, 2023

- Fix: all-watchers should be non-nullable, consistent with non-nullable all-finders
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Flutter Data is an offline-first data framework with a customizable REST client

## 👩🏾‍💻 Quick introduction

In Flutter Data, every model gets is adapter. These adapters can be extended by mixing in custom adapters.
In Flutter Data, every model gets its default adapter. These adapters can be extended by mixing in custom adapters.

Annotate a model with `@DataAdapter` and pass a custom adapter:

Expand Down Expand Up @@ -150,6 +150,11 @@ Fully compatible with the tools we know and love:

- [Drexbible](https://snapcraft.io/drexbible)

## 🚨 BREAKING CHANGES IN 2.0

- All methods are now directly on `Adapter`, there is no `Repository`, `RemoteAdapter` or `LocalAdapter`. Any method you are looking for is probably on `Adapter`, for example, `findAll` from `LocalAdapter` is now called `findAllLocal`
- For initialization we no longer call the `configure...` method on the Riverpod overrides, we just do `localStorageProvider.overrideWithValue` and pass a `LocalStorage` instance; the actual initialization is done via `initializeFlutterData` which needs an adapter map. An `adapterProvidersMap` is conveniently code-generated and available on `main.data.dart`

## 📚 API

### Adapters
Expand Down Expand Up @@ -206,7 +211,7 @@ Future<List<T>> findAll({
Future<T?> findOne(
Object id, {
bool remote = true,
bool? background,
bool background = false,
Map<String, dynamic>? params,
Map<String, String>? headers,
OnSuccessOne<T>? onSuccess,
Expand Down
14 changes: 0 additions & 14 deletions example/.vscode/launch.json

This file was deleted.

4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ void main() async {

container = ProviderContainer(
overrides: [
localStorageProvider.overrideWith(
(ref) => LocalStorage(
localStorageProvider.overrideWithValue(
LocalStorage(
baseDirFn: () => _dir.path,
clear: LocalStorageClearStrategy.always,
),
Expand Down
70 changes: 35 additions & 35 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "0f7b1783ddb1e4600580b8c00d0ddae5b06ae7f0382bd4fcce5db4df97b618e1"
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
url: "https://pub.dev"
source: hosted
version: "66.0.0"
version: "67.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: "5e8bdcda061d91da6b034d64d8e4026f355bcb8c3e7a0ac2da1523205a91a737"
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
url: "https://pub.dev"
source: hosted
version: "6.4.0"
version: "6.4.1"
args:
dependency: transitive
description:
name: args
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
url: "https://pub.dev"
source: hosted
version: "2.4.2"
version: "2.5.0"
async:
dependency: transitive
description:
Expand Down Expand Up @@ -77,18 +77,18 @@ packages:
dependency: "direct dev"
description:
name: build_runner
sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21"
sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22"
url: "https://pub.dev"
source: hosted
version: "2.4.8"
version: "2.4.9"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185
sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799"
url: "https://pub.dev"
source: hosted
version: "7.2.11"
version: "7.3.0"
built_collection:
dependency: transitive
description:
Expand All @@ -101,10 +101,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: a3ec2e0f967bc47f69f95009bb93db936288d61d5343b9436e378b28a2f830c6
sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb
url: "https://pub.dev"
source: hosted
version: "8.9.0"
version: "8.9.2"
checked_yaml:
dependency: transitive
description:
Expand Down Expand Up @@ -149,10 +149,10 @@ packages:
dependency: transitive
description:
name: dart_style
sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368"
sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9"
url: "https://pub.dev"
source: hosted
version: "2.3.4"
version: "2.3.6"
equatable:
dependency: transitive
description:
Expand Down Expand Up @@ -191,15 +191,15 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.0-dev.1"
version: "2.0.0-rc2"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612"
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
url: "https://pub.dev"
source: hosted
version: "3.2.0"
version: "4.0.0"
glob:
dependency: transitive
description:
Expand All @@ -220,10 +220,10 @@ packages:
dependency: transitive
description:
name: http
sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.2.1"
http_multi_server:
dependency: transitive
description:
Expand Down Expand Up @@ -260,26 +260,26 @@ packages:
dependency: transitive
description:
name: js
sha256: "4186c61b32f99e60f011f7160e32c89a758ae9b1d0c6d28e2c02ef0382300e2b"
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.1"
json_annotation:
dependency: "direct main"
description:
name: json_annotation
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
url: "https://pub.dev"
source: hosted
version: "4.8.1"
version: "4.9.0"
json_serializable:
dependency: "direct dev"
description:
name: json_serializable
sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969
sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b
url: "https://pub.dev"
source: hosted
version: "6.7.1"
version: "6.8.0"
logging:
dependency: transitive
description:
Expand Down Expand Up @@ -308,10 +308,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.14.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -380,10 +380,10 @@ packages:
dependency: transitive
description:
name: riverpod
sha256: "942999ee48b899f8a46a860f1e13cee36f2f77609eb54c5b7a669bb20d550b11"
sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d
url: "https://pub.dev"
source: hosted
version: "2.4.9"
version: "2.5.1"
shelf:
dependency: transitive
description:
Expand Down Expand Up @@ -484,10 +484,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.1"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -516,18 +516,18 @@ packages:
dependency: transitive
description:
name: web
sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05"
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.4.2"
version: "0.5.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23"
sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
url: "https://pub.dev"
source: hosted
version: "2.4.3"
version: "2.4.5"
yaml:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions lib/src/adapter/adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ abstract class _BaseAdapter<T extends DataModelMixin<T>> with _Lifecycle {
db.execute(
'DELETE FROM $internalType WHERE key IN (${keys.map((_) => '?').join(', ')})',
intKeys);
core.deleteKeys(keys);
core.deleteKeysWithEdges(keys);
if (notify) {
core._notify([...keys], type: DataGraphEventType.removeNode);
}
Expand All @@ -285,7 +285,7 @@ abstract class _BaseAdapter<T extends DataModelMixin<T>> with _Lifecycle {
final _ = db.select('DELETE FROM $internalType RETURNING key;');
final keys =
_.map((e) => (e['key'] as int).typifyWith(internalType)).toList();
await core.deleteKeys(keys);
await core.deleteKeysWithEdges(keys);

if (notify) {
core._notify([internalType], type: DataGraphEventType.clear);
Expand Down
3 changes: 1 addition & 2 deletions lib/src/adapter/remote_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,13 @@ mixin _RemoteAdapter<T extends DataModelMixin<T>> on _SerializationAdapter<T> {
Future<T?> findOne(
Object id, {
bool remote = true,
bool? background,
bool background = false,
Map<String, dynamic>? params,
Map<String, String>? headers,
OnSuccessOne<T>? onSuccess,
OnErrorOne<T>? onError,
DataRequestLabel? label,
}) async {
background ??= false;
params = await defaultParams & params;
headers = await defaultHeaders & headers;

Expand Down
Loading

0 comments on commit 4f531ce

Please sign in to comment.