Jonatas

update to Getx 3.10

  1 +## [3.10.0]
  2 +Getx 3.10 released with CLI and Get Server.
  3 +- Added: analyser + effective dart (@Grohden)
  4 +- Added TextStyle to generalDialog title and message (@roipeker)
  5 +- renamed and added defaults transition duration and types in "GetInterface" (@roipeker)
  6 +- added missing parameters in Get.to/Get.offAll (@roipeker)
  7 +- added optional transitionDuration and transitionCurve to Get.dialog() (@roipeker)
  8 +- Changed HashMap<int,GetStateUpdate> to HashSet<GetStateUpdate> and allow update IDs groups on GetBuilder (@roipeker)
  9 +- Added a internal VoidCallback in GetStateUpdaterMixin::getUpdate (@roipeker)
  10 +- Added Curve property to routes (@roipeker)
  11 +- Improve docs, code cleanup, new GetStateUpdaterMixin and GetStateUpdate in favour of StateSetter on GetxController, GetBuilder, SimpleBuilder. (@roipeker)
  12 +- Added RxBool.toggle() as an easy shortcut for switching true/false values. (@roipeker)
  13 +- Added _RxImp.nil() to easily set the value to null (@roipeker)
  14 +- Added missing docs to Rx classes. (@roipeker)
  15 +- Added Get.delete(force:false) to Get extensions (@roipeker)
  16 +- Improvement Docs (@nipodemos)
  17 +- Cleanup route code (@justkawal)
  18 +- Extension to facilitate insert widgets inside a CustomScrollView (@alexkharech)
  19 +- Fix docs .obs examples (@kai-oswald)
  20 +- Added tag capability to GetView
  21 +- Improve code separation of RouteManagement and Internacionalization
  22 +
1 ## [3.8.0] 23 ## [3.8.0]
2 - Added: Snackbar Status: Open, Opening, Closing and Closed 24 - Added: Snackbar Status: Open, Opening, Closing and Closed
3 example: 25 example:
@@ -431,6 +431,8 @@ All workers returns a `Worker` instance, that you can use to cancel ( via `dispo @@ -431,6 +431,8 @@ All workers returns a `Worker` instance, that you can use to cancel ( via `dispo
431 - **`interval`** 431 - **`interval`**
432 'interval' is different from the debouce. debouce if the user makes 1000 changes to a variable within 1 second, he will send only the last one after the stipulated timer (the default is 800 milliseconds). Interval will instead ignore all user actions for the stipulated period. If you send events for 1 minute, 1000 per second, debounce will only send you the last one, when the user stops strafing events. interval will deliver events every second, and if set to 3 seconds, it will deliver 20 events that minute. This is recommended to avoid abuse, in functions where the user can quickly click on something and get some advantage (imagine that the user can earn coins by clicking on something, if he clicked 300 times in the same minute, he would have 300 coins, using interval, you you can set a time frame for 3 seconds, and even then clicking 300 or a thousand times, the maximum he would get in 1 minute would be 20 coins, clicking 300 or 1 million times). The debounce is suitable for anti-DDos, for functions like search where each change to onChange would cause a query to your api. Debounce will wait for the user to stop typing the name, to make the request. If it were used in the coin scenario mentioned above, the user would only win 1 coin, because it is only executed, when the user "pauses" for the established time. 432 'interval' is different from the debouce. debouce if the user makes 1000 changes to a variable within 1 second, he will send only the last one after the stipulated timer (the default is 800 milliseconds). Interval will instead ignore all user actions for the stipulated period. If you send events for 1 minute, 1000 per second, debounce will only send you the last one, when the user stops strafing events. interval will deliver events every second, and if set to 3 seconds, it will deliver 20 events that minute. This is recommended to avoid abuse, in functions where the user can quickly click on something and get some advantage (imagine that the user can earn coins by clicking on something, if he clicked 300 times in the same minute, he would have 300 coins, using interval, you you can set a time frame for 3 seconds, and even then clicking 300 or a thousand times, the maximum he would get in 1 minute would be 20 coins, clicking 300 or 1 million times). The debounce is suitable for anti-DDos, for functions like search where each change to onChange would cause a query to your api. Debounce will wait for the user to stop typing the name, to make the request. If it were used in the coin scenario mentioned above, the user would only win 1 coin, because it is only executed, when the user "pauses" for the established time.
433 433
  434 +- NOTE: Workers should always be used when starting a Controller or Class, so it should always be on onInit (recommended), Class constructor, or the initState of a StatefulWidget (this practice is not recommended in most cases, but it shouldn't have any side effects).
  435 +
434 ## Simple State Manager 436 ## Simple State Manager
435 437
436 Get has a state manager that is extremely light and easy, which does not use ChangeNotifier, will meet the need especially for those new to Flutter, and will not cause problems for large applications. 438 Get has a state manager that is extremely light and easy, which does not use ChangeNotifier, will meet the need especially for those new to Flutter, and will not cause problems for large applications.
@@ -572,6 +572,8 @@ interval(count1, (_) => print("interval $_"), time: Duration(seconds: 1)); @@ -572,6 +572,8 @@ interval(count1, (_) => print("interval $_"), time: Duration(seconds: 1));
572 572
573 - interval: es diferente del debouce. Con debouce si el usuario realiza 1000 cambios en una variable dentro de 1 segundo, enviará solo el último después del timer estipulado (el valor predeterminado es 800 milisegundos). En cambio, el interval ignorará todas las acciones del usuario durante el período estipulado. Si envía eventos durante 1 minuto, 1000 por segundo, la función antirrebote solo le enviará el último, cuando el usuario deje de enviar eventos. Interval entregará eventos cada segundo, y si se establece en 3 segundos, entregará 20 eventos ese minuto. Esto se recomienda para evitar abusos, en funciones en las que el usuario puede hacer clic rápidamente en algo y obtener alguna ventaja (imagine que el usuario puede ganar monedas haciendo clic en algo, si hace clic 300 veces en el mismo minuto, tendría 300 monedas, usando el interval, puede establecer un time frame de 3 segundos, e incluso luego hacer clic 300 o mil veces, el máximo que obtendría en 1 minuto sería 20 monedas, haciendo clic 300 o 1 millón de veces). El debouce es adecuado para anti-DDos, para funciones como la búsqueda donde cada cambio en onChange provocaría una consulta en su API. Debounce esperará a que el usuario deje de escribir el nombre para realizar la solicitud. Si se usara en el escenario de monedas mencionado anteriormente, el usuario solo ganaría 1 moneda, ya que solo se ejecuta cuando el usuario "hace una pausa" durante el tiempo establecido. 573 - interval: es diferente del debouce. Con debouce si el usuario realiza 1000 cambios en una variable dentro de 1 segundo, enviará solo el último después del timer estipulado (el valor predeterminado es 800 milisegundos). En cambio, el interval ignorará todas las acciones del usuario durante el período estipulado. Si envía eventos durante 1 minuto, 1000 por segundo, la función antirrebote solo le enviará el último, cuando el usuario deje de enviar eventos. Interval entregará eventos cada segundo, y si se establece en 3 segundos, entregará 20 eventos ese minuto. Esto se recomienda para evitar abusos, en funciones en las que el usuario puede hacer clic rápidamente en algo y obtener alguna ventaja (imagine que el usuario puede ganar monedas haciendo clic en algo, si hace clic 300 veces en el mismo minuto, tendría 300 monedas, usando el interval, puede establecer un time frame de 3 segundos, e incluso luego hacer clic 300 o mil veces, el máximo que obtendría en 1 minuto sería 20 monedas, haciendo clic 300 o 1 millón de veces). El debouce es adecuado para anti-DDos, para funciones como la búsqueda donde cada cambio en onChange provocaría una consulta en su API. Debounce esperará a que el usuario deje de escribir el nombre para realizar la solicitud. Si se usara en el escenario de monedas mencionado anteriormente, el usuario solo ganaría 1 moneda, ya que solo se ejecuta cuando el usuario "hace una pausa" durante el tiempo establecido.
574 574
  575 +- NOTE: Los Workers siempre deben usarse al iniciar un controlador o clase, por lo que siempre debe estar en onInit (recomendado), Class Constructor o initState de un StatefulWidget (esta práctica no se recomienda en la mayoría de los casos, pero no debería tener efectos secundarios).
  576 +
575 ## Mezclando los dos State Managers 577 ## Mezclando los dos State Managers
576 578
577 Algunas personas abrieron una feature request, ya que querían usar solo un tipo de variable reactiva, y la otra mecánica, y necesitaban insertar un Obx en un GetBuilder para esto. Pensando en ello, se creó MixinBuilder. Permite cambios reactivos cambiando las variables ".obs" y actualizaciones mecánicas a través de update(). Sin embargo, de los 4 widgets, es el que consume más recursos, ya que además de tener una suscripción para recibir eventos de cambio de sus hijos, se suscribe al método update de su controlador. 579 Algunas personas abrieron una feature request, ya que querían usar solo un tipo de variable reactiva, y la otra mecánica, y necesitaban insertar un Obx en un GetBuilder para esto. Pensando en ello, se creó MixinBuilder. Permite cambios reactivos cambiando las variables ".obs" y actualizaciones mecánicas a través de update(). Sin embargo, de los 4 widgets, es el que consume más recursos, ya que además de tener una suscripción para recibir eventos de cambio de sus hijos, se suscribe al método update de su controlador.
@@ -497,3 +497,5 @@ interval(count1, (value) => print("interval $value"), time: Duration(seconds: 1) @@ -497,3 +497,5 @@ interval(count1, (value) => print("interval $value"), time: Duration(seconds: 1)
497 497
498 * **interval** 498 * **interval**
499 Quando se usa `debounce` , se o usuário fizer 1000 mudanças numa variável em 1 segundo, o `debounce` só computa a última mudança feita após a inatividade por um tempo estipulado (o padrão é 800 milisegundos). `interval` por outro lado vai ignorar todas as ações do usuário pelo período estipulado. Se o `interval` for de 1 segundo, então ele só conseguirá enviar 60 eventos por segundo. Se for 3 segundos de prazo, então o `interval` vai enviar 20 eventos por minuto (diferente do `debounce` que só enviaria o evento depois que o prazo estipulado acabar). Isso é recomendado para evitar abuso em funções que o usuário pode clicar rapidamente em algo para ter uma vantagem. Para exemplificar, imagine que o usuário pode ganhar moedas clicando num botão. Se ele clicar 300 vezes no botão em um minuto, ele vai ganhar 300 moedas. Usando o `interval`, você pode definir um prazo de 1 segundo por exemplo, e mesmo se ele clicasse 300 vezes em um minuto, ele ganharia apenas 60 moedas. Se fosse usado o `debounce`, o usuário ganharia apenas 1 moeda, porque só é executado quando o usuário para de clicar por um prazo estabelecido. 499 Quando se usa `debounce` , se o usuário fizer 1000 mudanças numa variável em 1 segundo, o `debounce` só computa a última mudança feita após a inatividade por um tempo estipulado (o padrão é 800 milisegundos). `interval` por outro lado vai ignorar todas as ações do usuário pelo período estipulado. Se o `interval` for de 1 segundo, então ele só conseguirá enviar 60 eventos por segundo. Se for 3 segundos de prazo, então o `interval` vai enviar 20 eventos por minuto (diferente do `debounce` que só enviaria o evento depois que o prazo estipulado acabar). Isso é recomendado para evitar abuso em funções que o usuário pode clicar rapidamente em algo para ter uma vantagem. Para exemplificar, imagine que o usuário pode ganhar moedas clicando num botão. Se ele clicar 300 vezes no botão em um minuto, ele vai ganhar 300 moedas. Usando o `interval`, você pode definir um prazo de 1 segundo por exemplo, e mesmo se ele clicasse 300 vezes em um minuto, ele ganharia apenas 60 moedas. Se fosse usado o `debounce`, o usuário ganharia apenas 1 moeda, porque só é executado quando o usuário para de clicar por um prazo estabelecido.
  500 +
  501 +- NOTA: Workers devem ser utilizados sempre na inicialização de um Controller ou Classe, dessa forma, ele deve estar sempre no onInit (recomendado), no Construtor de classe, ou no initState de um StatefulWidget (essa prática não é recomendada na maioria dos casos, mas não deve trazer efeitos colaterais).
@@ -73,7 +73,7 @@ packages: @@ -73,7 +73,7 @@ packages:
73 path: ".." 73 path: ".."
74 relative: true 74 relative: true
75 source: path 75 source: path
76 - version: "3.8.0" 76 + version: "3.10.0"
77 http_parser: 77 http_parser:
78 dependency: transitive 78 dependency: transitive
79 description: 79 description:
1 import 'package:flutter/widgets.dart'; 1 import 'package:flutter/widgets.dart';
2 -  
3 import '../../../instance_manager.dart'; 2 import '../../../instance_manager.dart';
4 import '../../../route_manager.dart'; 3 import '../../../route_manager.dart';
5 4
@@ -533,6 +533,7 @@ extension GetNavigation on GetInterface { @@ -533,6 +533,7 @@ extension GetNavigation on GetInterface {
533 Widget cancel, 533 Widget cancel,
534 Widget custom, 534 Widget custom,
535 Color backgroundColor, 535 Color backgroundColor,
  536 + bool barrierDismissible = true,
536 Color buttonColor, 537 Color buttonColor,
537 String middleText = "Dialog made in 3 lines of code", 538 String middleText = "Dialog made in 3 lines of code",
538 TextStyle middleTextStyle, 539 TextStyle middleTextStyle,
@@ -618,6 +619,7 @@ extension GetNavigation on GetInterface { @@ -618,6 +619,7 @@ extension GetNavigation on GetInterface {
618 // actions: actions, // ?? <Widget>[cancelButton, confirmButton], 619 // actions: actions, // ?? <Widget>[cancelButton, confirmButton],
619 buttonPadding: EdgeInsets.zero, 620 buttonPadding: EdgeInsets.zero,
620 ), 621 ),
  622 + barrierDismissible: barrierDismissible,
621 ); 623 );
622 } 624 }
623 625
@@ -113,15 +113,15 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -113,15 +113,15 @@ class GetPageRoute<T> extends PageRoute<T> {
113 Animation<double> animation, 113 Animation<double> animation,
114 Animation<double> secondaryAnimation, 114 Animation<double> secondaryAnimation,
115 ) { 115 ) {
  116 + GetConfig.currentRoute = settings.name ?? routeName;
116 binding?.dependencies(); 117 binding?.dependencies();
117 if (bindings != null) { 118 if (bindings != null) {
118 for (final binding in bindings) { 119 for (final binding in bindings) {
119 binding.dependencies(); 120 binding.dependencies();
120 } 121 }
121 } 122 }
122 - final pageWidget = page();  
123 - GetConfig.currentRoute = settings.name ?? routeName;  
124 - return pageWidget; 123 + // final pageWidget = page();
  124 + return page();
125 } 125 }
126 126
127 static bool isPopGestureInProgress(PageRoute<dynamic> route) { 127 static bool isPopGestureInProgress(PageRoute<dynamic> route) {
@@ -84,7 +84,7 @@ class GetObserver extends NavigatorObserver { @@ -84,7 +84,7 @@ class GetObserver extends NavigatorObserver {
84 } 84 }
85 GetConfig.currentRoute = routeName; 85 GetConfig.currentRoute = routeName;
86 86
87 - _routeSend.update((value) { 87 + _routeSend?.update((value) {
88 if (route is PageRoute) value.current = routeName; 88 if (route is PageRoute) value.current = routeName;
89 value.args = route?.settings?.arguments; 89 value.args = route?.settings?.arguments;
90 value.route = route; 90 value.route = route;
@@ -117,7 +117,7 @@ class GetObserver extends NavigatorObserver { @@ -117,7 +117,7 @@ class GetObserver extends NavigatorObserver {
117 } 117 }
118 GetConfig.currentRoute = routeName; 118 GetConfig.currentRoute = routeName;
119 119
120 - _routeSend.update((value) { 120 + _routeSend?.update((value) {
121 if (previousRoute is PageRoute) { 121 if (previousRoute is PageRoute) {
122 value.current = previousRoute?.settings?.name ?? ''; 122 value.current = previousRoute?.settings?.name ?? '';
123 } 123 }
@@ -142,7 +142,7 @@ class GetObserver extends NavigatorObserver { @@ -142,7 +142,7 @@ class GetObserver extends NavigatorObserver {
142 142
143 GetConfig.currentRoute = name(newRoute); 143 GetConfig.currentRoute = name(newRoute);
144 144
145 - _routeSend.update((value) { 145 + _routeSend?.update((value) {
146 if (newRoute is PageRoute) value.current = newRoute?.settings?.name ?? ''; 146 if (newRoute is PageRoute) value.current = newRoute?.settings?.name ?? '';
147 value.args = newRoute?.settings?.arguments; 147 value.args = newRoute?.settings?.arguments;
148 value.route = newRoute; 148 value.route = newRoute;
@@ -161,7 +161,7 @@ class GetObserver extends NavigatorObserver { @@ -161,7 +161,7 @@ class GetObserver extends NavigatorObserver {
161 super.didRemove(route, previousRoute); 161 super.didRemove(route, previousRoute);
162 GetConfig.log("REMOVING ROUTE ${route?.settings?.name}"); 162 GetConfig.log("REMOVING ROUTE ${route?.settings?.name}");
163 163
164 - _routeSend.update((value) { 164 + _routeSend?.update((value) {
165 value.route = previousRoute; 165 value.route = previousRoute;
166 value.isBack = false; 166 value.isBack = false;
167 value.removed = route?.settings?.name ?? ''; 167 value.removed = route?.settings?.name ?? '';
1 name: get 1 name: get
2 description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX. 2 description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX.
3 -version: 3.8.0 3 +version: 3.10.0
4 homepage: https://github.com/jonataslaw/get 4 homepage: https://github.com/jonataslaw/get
5 5
6 environment: 6 environment: