Skip to content

Commit b3b40b5

Browse files
committed
Bump version to 8.3.0 and fix failing test
- Update CHANGELOG.md with user-facing changes for v8.3.0 - Bump version in pubspec.yaml to 8.3.0 - Fix failing test: callback is called even with signalsReady - Created AsyncTestServiceWithSignal class implementing WillSignalReady - Fixed unawaited Future.delayed causing test to fail after completion
1 parent 231a5ae commit b3b40b5

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [8.3.0]
2+
3+
* Added `findAll()` method for finding all registered instances by type with flexible matching options (subtypes, interfaces, scope filtering)
4+
* Added `resetLazySingletons()` method to reset multiple lazy singletons at once with optional scope parameters
5+
* Added `onCreated` callback parameter to `registerLazySingleton`, `registerLazySingletonAsync`, and `registerSingletonAsync` for lifecycle hooks
6+
* Improved parameter validation error messages in debug mode - now provides clear, actionable feedback when wrong parameter types are passed to factories
7+
* Fixed bug in cached factories where parameter validation could throw unhelpful errors
8+
19
## [8.2.0]
210

311
Thanks to PR by @Hu-Wentao we now expose part of the internal state of get_it so tool authors have more options. While doing so internal renaming has happened, so where previously where the term "ServiceFactory" was uses we not use consistently `ObjectRegistration` and instead of variables with `factory` in the name we use `registration` this has not impact on the public API so it is not a breaking change.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ packages:
124124
path: ".."
125125
relative: true
126126
source: path
127-
version: "8.2.0"
127+
version: "8.3.0"
128128
glob:
129129
dependency: transitive
130130
description:

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: get_it
22
description: Simple direct Service Locator that allows to decouple the interface from a concrete implementation and to access the concrete implementation from everywhere in your App"
3-
version: 8.2.0
3+
version: 8.3.0
44
maintainer: Thomas Burkhart (@escamoteur)
55
homepage: https://github.com/flutter-it/get_it
66
funding:

test/on_created_test.dart

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ class AsyncTestService {
2323
}
2424
}
2525

26+
class AsyncTestServiceWithSignal extends AsyncTestService
27+
implements WillSignalReady {
28+
AsyncTestServiceWithSignal(super.id);
29+
30+
Future<void> init() async {
31+
await Future.delayed(const Duration(milliseconds: 10));
32+
GetIt.I.signalReady(this);
33+
}
34+
}
35+
2636
void main() {
2737
setUp(() async {
2838
await GetIt.I.reset();
@@ -246,13 +256,11 @@ void main() {
246256
});
247257

248258
test('callback is called even with signalsReady', () async {
249-
GetIt.I.registerSingletonAsync<AsyncTestService>(
259+
GetIt.I.registerSingletonAsync<AsyncTestServiceWithSignal>(
250260
() async {
251-
final instance = AsyncTestService('singleton1');
252-
// Signal ready after a delay to allow instance to be stored
253-
Future.delayed(const Duration(milliseconds: 10), () {
254-
GetIt.I.signalReady(instance);
255-
});
261+
final instance = AsyncTestServiceWithSignal('singleton1');
262+
// Instance will signal ready from its init method
263+
instance.init();
256264
return instance;
257265
},
258266
signalsReady: true,
@@ -261,7 +269,7 @@ void main() {
261269
},
262270
);
263271

264-
await GetIt.I.isReady<AsyncTestService>();
272+
await GetIt.I.isReady<AsyncTestServiceWithSignal>();
265273

266274
expect(onCreatedCounter, 1);
267275
});

0 commit comments

Comments
 (0)