fluttercommunity / get_it

Get It - 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. Maintainer: @escamoteur
https://pub.dev/packages/get_it
MIT License
1.35k stars 148 forks source link

Update README.md #368

Closed liruohrh closed 2 months ago

liruohrh commented 3 months ago

reset function annotation is wrong, it is not disposes all registered types but clears all registered types

escamoteur commented 3 months ago

It also calls any registered dispose functions m, so why is it wrong? Am 24. Juli 2024, 14:42 +0100 schrieb liruohrh @.***>:

reset function annotation is wrong, it is not disposes all registered types but clears all registered types You can view, comment on, or merge this pull request online at: https://github.com/fluttercommunity/get_it/pull/368 Commit Summary

• e9385f1 Update README.md

File Changes (1 file)

• M README.md (2)

Patch Links:

https://github.com/fluttercommunity/get_it/pull/368.patchhttps://github.com/fluttercommunity/get_it/pull/368.diff

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

liruohrh commented 3 months ago

Reason

In get_it.dart, annotation of reset is:

  /// Clears all registered types in the reverse order in which they were registered.
  /// Handy when writing unit tests or when disposing services that depend on each other.
  /// If you provided dispose function when registering they will be called
  /// [dispose] if `false` it only resets without calling any dispose
  /// functions
  /// As dispose functions can be async, you should await this function.
  Future<void> reset({bool dispose = true});

and annotation of resetScope is also Clears but not Disposes.

But in README.md the annotation is: Disposes all registered types., even in README.md, resetLazySingleton is a little bit above the reset is also Clears but not Disposes.

My view

  1. My english is not so good. In my opinion, Clears all registered types and Disposes all registered types is different
  2. More importantly, I think the annotation should be the same, at least the meaning is the same. But in get_it, for annotation , README.md is different from get_it.dart.
escamoteur commented 3 months ago

You are right will correct it in the next release Am 25. Juli 2024, 05:31 +0100 schrieb liruohrh @.***>:

Reason In get_it.dart, annotation of reset is: /// Clears all registered types in the reverse order in which they were registered. /// Handy when writing unit tests or when disposing services that depend on each other. /// If you provided dispose function when registering they will be called /// [dispose] if false it only resets without calling any dispose /// functions /// As dispose functions can be async, you should await this function. Future reset({bool dispose = true}); and annotation of resetScope is also Clears but not Disposes. But in README.md the annotation is: Disposes all registered types., even in README.md, resetLazySingleton is a little bit above the reset is also Clears but not Disposes. My view

  1. My english is not so good. In my opinion, Clears all registered types and Disposes all registered types is different
  2. More importantly, I think the annotation should be the same, at least the meaning is the same. But in get_it, for annotation , README.md is different from get_it.dart.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>