Skip to content

Commit 4f531ce

Browse files
committed
misc fixes
1 parent a5b86c7 commit 4f531ce

File tree

20 files changed

+217
-201
lines changed

20 files changed

+217
-201
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ coverage_badge.svg
2121
.pub/
2222
build/
2323
tmp/
24-
download/
24+
download/
25+
26+
.vscode/launch.json
27+
example/.vscode/launch.json

.vscode/launch.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [2.0.0-rc2] - April 24th, 2024
4+
5+
- New version based on `sqlite3`
6+
37
## [1.5.14] - September 22nd, 2023
48

59
- Fix: all-watchers should be non-nullable, consistent with non-nullable all-finders

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Flutter Data is an offline-first data framework with a customizable REST client
3030

3131
## 👩🏾‍💻 Quick introduction
3232

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

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

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

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

153+
## 🚨 BREAKING CHANGES IN 2.0
154+
155+
- 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`
156+
- 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`
157+
153158
## 📚 API
154159

155160
### Adapters
@@ -206,7 +211,7 @@ Future<List<T>> findAll({
206211
Future<T?> findOne(
207212
Object id, {
208213
bool remote = true,
209-
bool? background,
214+
bool background = false,
210215
Map<String, dynamic>? params,
211216
Map<String, String>? headers,
212217
OnSuccessOne<T>? onSuccess,

example/.vscode/launch.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

example/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ void main() async {
1616

1717
container = ProviderContainer(
1818
overrides: [
19-
localStorageProvider.overrideWith(
20-
(ref) => LocalStorage(
19+
localStorageProvider.overrideWithValue(
20+
LocalStorage(
2121
baseDirFn: () => _dir.path,
2222
clear: LocalStorageClearStrategy.always,
2323
),

example/pubspec.lock

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ packages:
55
dependency: transitive
66
description:
77
name: _fe_analyzer_shared
8-
sha256: "0f7b1783ddb1e4600580b8c00d0ddae5b06ae7f0382bd4fcce5db4df97b618e1"
8+
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "66.0.0"
11+
version: "67.0.0"
1212
analyzer:
1313
dependency: transitive
1414
description:
1515
name: analyzer
16-
sha256: "5e8bdcda061d91da6b034d64d8e4026f355bcb8c3e7a0ac2da1523205a91a737"
16+
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
1717
url: "https://pub.dev"
1818
source: hosted
19-
version: "6.4.0"
19+
version: "6.4.1"
2020
args:
2121
dependency: transitive
2222
description:
2323
name: args
24-
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
24+
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
2525
url: "https://pub.dev"
2626
source: hosted
27-
version: "2.4.2"
27+
version: "2.5.0"
2828
async:
2929
dependency: transitive
3030
description:
@@ -77,18 +77,18 @@ packages:
7777
dependency: "direct dev"
7878
description:
7979
name: build_runner
80-
sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21"
80+
sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22"
8181
url: "https://pub.dev"
8282
source: hosted
83-
version: "2.4.8"
83+
version: "2.4.9"
8484
build_runner_core:
8585
dependency: transitive
8686
description:
8787
name: build_runner_core
88-
sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185
88+
sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799"
8989
url: "https://pub.dev"
9090
source: hosted
91-
version: "7.2.11"
91+
version: "7.3.0"
9292
built_collection:
9393
dependency: transitive
9494
description:
@@ -101,10 +101,10 @@ packages:
101101
dependency: transitive
102102
description:
103103
name: built_value
104-
sha256: a3ec2e0f967bc47f69f95009bb93db936288d61d5343b9436e378b28a2f830c6
104+
sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb
105105
url: "https://pub.dev"
106106
source: hosted
107-
version: "8.9.0"
107+
version: "8.9.2"
108108
checked_yaml:
109109
dependency: transitive
110110
description:
@@ -149,10 +149,10 @@ packages:
149149
dependency: transitive
150150
description:
151151
name: dart_style
152-
sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368"
152+
sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9"
153153
url: "https://pub.dev"
154154
source: hosted
155-
version: "2.3.4"
155+
version: "2.3.6"
156156
equatable:
157157
dependency: transitive
158158
description:
@@ -191,15 +191,15 @@ packages:
191191
path: ".."
192192
relative: true
193193
source: path
194-
version: "2.0.0-dev.1"
194+
version: "2.0.0-rc2"
195195
frontend_server_client:
196196
dependency: transitive
197197
description:
198198
name: frontend_server_client
199-
sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612"
199+
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
200200
url: "https://pub.dev"
201201
source: hosted
202-
version: "3.2.0"
202+
version: "4.0.0"
203203
glob:
204204
dependency: transitive
205205
description:
@@ -220,10 +220,10 @@ packages:
220220
dependency: transitive
221221
description:
222222
name: http
223-
sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba
223+
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
224224
url: "https://pub.dev"
225225
source: hosted
226-
version: "1.2.0"
226+
version: "1.2.1"
227227
http_multi_server:
228228
dependency: transitive
229229
description:
@@ -260,26 +260,26 @@ packages:
260260
dependency: transitive
261261
description:
262262
name: js
263-
sha256: "4186c61b32f99e60f011f7160e32c89a758ae9b1d0c6d28e2c02ef0382300e2b"
263+
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
264264
url: "https://pub.dev"
265265
source: hosted
266-
version: "0.7.0"
266+
version: "0.7.1"
267267
json_annotation:
268268
dependency: "direct main"
269269
description:
270270
name: json_annotation
271-
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
271+
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
272272
url: "https://pub.dev"
273273
source: hosted
274-
version: "4.8.1"
274+
version: "4.9.0"
275275
json_serializable:
276276
dependency: "direct dev"
277277
description:
278278
name: json_serializable
279-
sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969
279+
sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b
280280
url: "https://pub.dev"
281281
source: hosted
282-
version: "6.7.1"
282+
version: "6.8.0"
283283
logging:
284284
dependency: transitive
285285
description:
@@ -308,10 +308,10 @@ packages:
308308
dependency: transitive
309309
description:
310310
name: meta
311-
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
311+
sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
312312
url: "https://pub.dev"
313313
source: hosted
314-
version: "1.11.0"
314+
version: "1.14.0"
315315
mime:
316316
dependency: transitive
317317
description:
@@ -380,10 +380,10 @@ packages:
380380
dependency: transitive
381381
description:
382382
name: riverpod
383-
sha256: "942999ee48b899f8a46a860f1e13cee36f2f77609eb54c5b7a669bb20d550b11"
383+
sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d
384384
url: "https://pub.dev"
385385
source: hosted
386-
version: "2.4.9"
386+
version: "2.5.1"
387387
shelf:
388388
dependency: transitive
389389
description:
@@ -484,10 +484,10 @@ packages:
484484
dependency: transitive
485485
description:
486486
name: test_api
487-
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
487+
sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
488488
url: "https://pub.dev"
489489
source: hosted
490-
version: "0.7.0"
490+
version: "0.7.1"
491491
timing:
492492
dependency: transitive
493493
description:
@@ -516,18 +516,18 @@ packages:
516516
dependency: transitive
517517
description:
518518
name: web
519-
sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05"
519+
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
520520
url: "https://pub.dev"
521521
source: hosted
522-
version: "0.4.2"
522+
version: "0.5.1"
523523
web_socket_channel:
524524
dependency: transitive
525525
description:
526526
name: web_socket_channel
527-
sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23"
527+
sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
528528
url: "https://pub.dev"
529529
source: hosted
530-
version: "2.4.3"
530+
version: "2.4.5"
531531
yaml:
532532
dependency: transitive
533533
description:

lib/src/adapter/adapter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ abstract class _BaseAdapter<T extends DataModelMixin<T>> with _Lifecycle {
272272
db.execute(
273273
'DELETE FROM $internalType WHERE key IN (${keys.map((_) => '?').join(', ')})',
274274
intKeys);
275-
core.deleteKeys(keys);
275+
core.deleteKeysWithEdges(keys);
276276
if (notify) {
277277
core._notify([...keys], type: DataGraphEventType.removeNode);
278278
}
@@ -285,7 +285,7 @@ abstract class _BaseAdapter<T extends DataModelMixin<T>> with _Lifecycle {
285285
final _ = db.select('DELETE FROM $internalType RETURNING key;');
286286
final keys =
287287
_.map((e) => (e['key'] as int).typifyWith(internalType)).toList();
288-
await core.deleteKeys(keys);
288+
await core.deleteKeysWithEdges(keys);
289289

290290
if (notify) {
291291
core._notify([internalType], type: DataGraphEventType.clear);

lib/src/adapter/remote_adapter.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,13 @@ mixin _RemoteAdapter<T extends DataModelMixin<T>> on _SerializationAdapter<T> {
123123
Future<T?> findOne(
124124
Object id, {
125125
bool remote = true,
126-
bool? background,
126+
bool background = false,
127127
Map<String, dynamic>? params,
128128
Map<String, String>? headers,
129129
OnSuccessOne<T>? onSuccess,
130130
OnErrorOne<T>? onError,
131131
DataRequestLabel? label,
132132
}) async {
133-
background ??= false;
134133
params = await defaultParams & params;
135134
headers = await defaultHeaders & headers;
136135

0 commit comments

Comments
 (0)