Skip to content

Commit

Permalink
clean up, upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
frank06 committed Apr 26, 2024
1 parent 4f531ce commit ad1f65e
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 140 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ jobs:
run: dart test
- name: Generate coverage
if: runner.os == 'macOS'
run: dart run coverage:test_with_coverage
run: dart run test --coverage=coverage
- name: Convert to lcov
run: dart pub global run coverage:format_coverage --in="./coverage/test" --out="./coverage/lcov.info" --lcov --report-on="./lib"
- name: Send coverage report to codecov
if: runner.os == 'macOS'
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion example/lib/models/task.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/lib/models/user.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 1 addition & 25 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.0-rc2"
version: "2.0.0-rc3"
frontend_server_client:
dependency: transitive
description:
Expand Down Expand Up @@ -296,14 +296,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.12.16+1"
messagepack:
dependency: transitive
description:
name: messagepack
sha256: "11e69dd79ba84ba901261558881b42ac8b24155a7846a344875a32c8b0866d71"
url: "https://pub.dev"
source: hosted
version: "0.2.1"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -360,22 +352,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.3"
recase:
dependency: transitive
description:
name: recase
sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213
url: "https://pub.dev"
source: hosted
version: "4.1.0"
retry:
dependency: transitive
description:
name: retry
sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
riverpod:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ environment:
dependencies:
flutter_data:
path: ../../flutter_data
json_annotation: ^4.8.0
json_annotation: ^4.9.0

dev_dependencies:
build_runner: ^2.0.4
json_serializable: ^6.1.3
json_serializable: ^6.8.0
1 change: 0 additions & 1 deletion lib/flutter_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:http/http.dart' as http;
import 'package:inflection3/inflection3.dart' as inflection;
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path_helper;
import 'package:pool/pool.dart';
import 'package:riverpod/riverpod.dart';
import 'package:sqlite3/sqlite3.dart';
import 'package:state_notifier/state_notifier.dart';
Expand Down
4 changes: 0 additions & 4 deletions lib/src/utils/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ extension _DataModelListX on Iterable<DataModelMixin> {
}
}

extension _ListX<T> on List<T> {
T? getSafe(int index) => (length > index) ? this[index] : null;
}

extension DynamicX on dynamic {
String typifyWith(String type) {
final _this = this.toString();
Expand Down
54 changes: 0 additions & 54 deletions lib/src/utils/offline_operations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,57 +131,3 @@ extension OfflineOperationsX on Set<OfflineOperation<DataModelMixin>> {
// stores onSuccess/onError function combos
final _offlineCallbackProvider =
StateProvider<Map<String, (Function?, Function?)>>((_) => {});

// providers

final offlineRetryProvider = StreamProvider<void>((ref) async* {
Set<OfflineOperation> _offlineOperations() {
return _internalAdaptersMap!.values
.map((adapter) {
// if the stream is called before initialization
// (or after disposal) simply return an empty set
if (!adapter.isInitialized) {
return <OfflineOperation>{};
}
return adapter.offlineOperations;
})
.expand((e) => e)
.toSet();
}

final pool = Pool(4, timeout: Duration(seconds: 30));

var _counter = 0;

while (true) {
// sort operations by timestamp
final ops = _offlineOperations().toList()
..sort((a, b) => a.timestamp.compareTo(b.timestamp));

if (ops.isEmpty) {
_counter = 0;
await Future.delayed(Duration(milliseconds: backoffFn(4)));
continue;
}

print(
'[offline] retrying ${ops.length} operations: ${ops.map((op) => op.label)}');

try {
final result = pool.forEach(
ops,
(OfflineOperation op) async => op.retry(),
);
await for (final _ in result) {}
} finally {
final duration =
Duration(milliseconds: backoffFn(_counter) + ops.length * 50);
print('[offline] waiting $duration to try again');
await Future.delayed(duration);
_counter++;
}
}
});

final backoffFn =
(int i) => [400, 800, 1600, 3200, 6400, 12800, 12800].getSafe(i) ?? 25600;
36 changes: 6 additions & 30 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages:
source: hosted
version: "67.0.0"
analyzer:
dependency: "direct main"
dependency: transitive
description:
name: analyzer
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
Expand All @@ -26,7 +26,7 @@ packages:
source: hosted
version: "2.5.0"
async:
dependency: "direct main"
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
Expand Down Expand Up @@ -146,15 +146,15 @@ packages:
source: hosted
version: "3.1.1"
coverage:
dependency: "direct dev"
dependency: transitive
description:
name: coverage
sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76"
url: "https://pub.dev"
source: hosted
version: "1.7.2"
crypto:
dependency: "direct main"
dependency: transitive
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
Expand Down Expand Up @@ -306,7 +306,7 @@ packages:
source: hosted
version: "0.7.1"
json_annotation:
dependency: "direct main"
dependency: "direct dev"
description:
name: json_annotation
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
Expand Down Expand Up @@ -345,14 +345,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.12.16+1"
messagepack:
dependency: "direct main"
description:
name: messagepack
sha256: "11e69dd79ba84ba901261558881b42ac8b24155a7846a344875a32c8b0866d71"
url: "https://pub.dev"
source: hosted
version: "0.2.1"
meta:
dependency: "direct main"
description:
Expand Down Expand Up @@ -402,7 +394,7 @@ packages:
source: hosted
version: "1.9.0"
pool:
dependency: "direct main"
dependency: transitive
description:
name: pool
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
Expand All @@ -425,22 +417,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.3"
recase:
dependency: "direct main"
description:
name: recase
sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213
url: "https://pub.dev"
source: hosted
version: "4.1.0"
retry:
dependency: "direct main"
description:
name: retry
sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
riverpod:
dependency: "direct main"
description:
Expand Down
18 changes: 5 additions & 13 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,17 @@ environment:
sdk: ">=3.1.0 <4.0.0"

dependencies:
analyzer: ^6.4.0
async: ^2.6.1
build: ^2.0.2
build_resolvers: ^2.0.10
collection: ^1.16.0
crypto: ^3.0.1
equatable: ^2.0.2
glob: ^2.0.1
http: ^1.2.0
http: ^1.2.1
inflection3: ^0.5.3+2
json_annotation: ^4.8.1
messagepack: ^0.2.1
meta: ^1.7.0
path: ^1.8.0
pool: ^1.5.1
pubspec_parse: ^1.0.0
recase: ^4.0.0
retry: ^3.1.0
riverpod: ^2.1.1
riverpod: ^2.5.1
source_gen: ^1.0.1
source_helper: ^1.3.2
sqlite3: ^2.4.2
Expand All @@ -37,10 +29,10 @@ dependencies:
dev_dependencies:
build_runner: ^2.3.0
build_test: ^2.1.0
coverage: ^1.3.2
freezed: ^2.3.0
freezed: ^2.5.2
freezed_annotation: ^2.0.1
json_serializable: ^6.6.1
json_annotation: ^4.9.0
json_serializable: ^6.8.0
lints: ^3.0.0
matcher: ^0.12.10
mockito: ^5.0.9
Expand Down
2 changes: 1 addition & 1 deletion test/_support/book.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ part of 'book.dart';
T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');

BookAuthor _$BookAuthorFromJson(Map<String, dynamic> json) {
return _BookAuthor.fromJson(json);
Expand Down
8 changes: 4 additions & 4 deletions test/_support/book.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/_support/node.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ part of 'node.dart';
T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');

Node _$NodeFromJson(Map<String, dynamic> json) {
return _Node.fromJson(json);
Expand Down
2 changes: 1 addition & 1 deletion test/_support/node.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ad1f65e

Please sign in to comment.