Aniketkhote / refreshed

Enhanced GetX for Flutter: Stability, Performance, Beginner-Friendly.
https://pub.dev/packages/refreshed
Other
67 stars 7 forks source link

Is there any tag length limit when using GetX widget? #32

Open uzuki-P opened 4 months ago

uzuki-P commented 4 months ago

Describe the bug Is there any tag length limit when using GetX widget? When I use a long tag the controller is not being disposed.

example: I create RegisterPage & TncPage, they both using same controller(RegisterController) just for testing. The TncPage using tag, while RegisterPage not using tag.

When using long tag like this on TncPage

GetX(
   init: RegisterController(),
   tag: DateTime.now().millisecondsSinceEpoch.toString(),
   builder: (ctrl) => Text('new controller: ${ctrl.count1.value}'),
),
Long tag logs is: ```txt Performing hot reload... Syncing files to device Redmi 4 Prime... Reloaded 1 of 2449 libraries in 1,789ms (compile: 33 ms, reload: 1040 ms, reassemble: 571 ms). I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPush: [OnboardingRoute] => [LoginRoute] I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPop: [LoginRoute] => [OnboardingRoute] I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPush: [OnboardingRoute] => [RegisterRoute] [Refreshed] Instance "RegisterController" has been created [Refreshed] Instance "RegisterController" has been initialized I/flutter ( 1021): [tpf] [πŸ’‘ INFO] onReady RegisterController I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPush: [RegisterRoute] => [TncRoute] [Refreshed] Instance "RegisterController" has been created with tag "1720070226767" [Refreshed] Instance "RegisterController" with tag "1720070226767" has been initialized I/flutter ( 1021): [tpf] [πŸ’‘ INFO] onReady RegisterController I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPop: [TncRoute] => [RegisterRoute] I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPop: [RegisterRoute] => [OnboardingRoute] I/flutter ( 1021): [tpf] [πŸ’‘ INFO] onClose RegisterController [Refreshed] "RegisterController" onDelete() called [Refreshed] "RegisterController" deleted from memory ```

When using short tag like this on TncPage

GetX(
   init: RegisterController(),
   tag: DateTime.now().millisecondsSinceEpoch.toString().substring(0, 4),
   builder: (ctrl) => Text('new controller: ${ctrl.count1.value}'),
),
Short tag logs is: ```txt Performing hot reload... Syncing files to device Redmi 4 Prime... Reloaded 2 of 2449 libraries in 1,760ms (compile: 37 ms, reload: 995 ms, reassemble: 596 ms). I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPush: [OnboardingRoute] => [LoginRoute] I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPop: [LoginRoute] => [OnboardingRoute] I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPush: [OnboardingRoute] => [RegisterRoute] [Refreshed] Instance "RegisterController" has been created [Refreshed] Instance "RegisterController" has been initialized I/flutter ( 1021): [tpf] [πŸ’‘ INFO] onReady RegisterController I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPush: [RegisterRoute] => [TncRoute] [Refreshed] Instance "RegisterController" has been created with tag "1720" [Refreshed] Instance "RegisterController" with tag "1720" has been initialized I/flutter ( 1021): [tpf] [πŸ’‘ INFO] onReady RegisterController I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPop: [TncRoute] => [RegisterRoute] I/flutter ( 1021): [tpf] [πŸ’‘ INFO] onClose RegisterController [Refreshed] "RegisterController1720" onDelete() called [Refreshed] "RegisterController1720" deleted from memory I/flutter ( 1021): [tpf] [πŸ’‘ INFO] [πŸ›£οΈ Route] didPop: [RegisterRoute] => [OnboardingRoute] I/flutter ( 1021): [tpf] [πŸ’‘ INFO] onClose RegisterController [Refreshed] "RegisterController" onDelete() called [Refreshed] "RegisterController" deleted from memory ```

Notice that the RegisterController1720 actually got deleted/disposed.

Flutter Version: Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22631.3737], locale en-ID)

Refreshed Version: refreshed: ^2.8.0