Jonatas

update to Getx 3.10

## [3.10.0]
Getx 3.10 released with CLI and Get Server.
- Added: analyser + effective dart (@Grohden)
- Added TextStyle to generalDialog title and message (@roipeker)
- renamed and added defaults transition duration and types in "GetInterface" (@roipeker)
- added missing parameters in Get.to/Get.offAll (@roipeker)
- added optional transitionDuration and transitionCurve to Get.dialog() (@roipeker)
- Changed HashMap<int,GetStateUpdate> to HashSet<GetStateUpdate> and allow update IDs groups on GetBuilder (@roipeker)
- Added a internal VoidCallback in GetStateUpdaterMixin::getUpdate (@roipeker)
- Added Curve property to routes (@roipeker)
- Improve docs, code cleanup, new GetStateUpdaterMixin and GetStateUpdate in favour of StateSetter on GetxController, GetBuilder, SimpleBuilder. (@roipeker)
- Added RxBool.toggle() as an easy shortcut for switching true/false values. (@roipeker)
- Added _RxImp.nil() to easily set the value to null (@roipeker)
- Added missing docs to Rx classes. (@roipeker)
- Added Get.delete(force:false) to Get extensions (@roipeker)
- Improvement Docs (@nipodemos)
- Cleanup route code (@justkawal)
- Extension to facilitate insert widgets inside a CustomScrollView (@alexkharech)
- Fix docs .obs examples (@kai-oswald)
- Added tag capability to GetView
- Improve code separation of RouteManagement and Internacionalization
## [3.8.0]
- Added: Snackbar Status: Open, Opening, Closing and Closed
example:
... ...
... ... @@ -431,6 +431,8 @@ All workers returns a `Worker` instance, that you can use to cancel ( via `dispo
- **`interval`**
'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.
- 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).
## Simple State Manager
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));
- 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.
- 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).
## Mezclando los dos State Managers
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)
* **interval**
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.
- 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).
\ No newline at end of file
... ...
... ... @@ -73,7 +73,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.8.0"
version: "3.10.0"
http_parser:
dependency: transitive
description:
... ...
import 'package:flutter/widgets.dart';
import '../../../instance_manager.dart';
import '../../../route_manager.dart';
... ...
... ... @@ -533,6 +533,7 @@ extension GetNavigation on GetInterface {
Widget cancel,
Widget custom,
Color backgroundColor,
bool barrierDismissible = true,
Color buttonColor,
String middleText = "Dialog made in 3 lines of code",
TextStyle middleTextStyle,
... ... @@ -618,6 +619,7 @@ extension GetNavigation on GetInterface {
// actions: actions, // ?? <Widget>[cancelButton, confirmButton],
buttonPadding: EdgeInsets.zero,
),
barrierDismissible: barrierDismissible,
);
}
... ...
... ... @@ -113,15 +113,15 @@ class GetPageRoute<T> extends PageRoute<T> {
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
GetConfig.currentRoute = settings.name ?? routeName;
binding?.dependencies();
if (bindings != null) {
for (final binding in bindings) {
binding.dependencies();
}
}
final pageWidget = page();
GetConfig.currentRoute = settings.name ?? routeName;
return pageWidget;
// final pageWidget = page();
return page();
}
static bool isPopGestureInProgress(PageRoute<dynamic> route) {
... ...
... ... @@ -84,7 +84,7 @@ class GetObserver extends NavigatorObserver {
}
GetConfig.currentRoute = routeName;
_routeSend.update((value) {
_routeSend?.update((value) {
if (route is PageRoute) value.current = routeName;
value.args = route?.settings?.arguments;
value.route = route;
... ... @@ -117,7 +117,7 @@ class GetObserver extends NavigatorObserver {
}
GetConfig.currentRoute = routeName;
_routeSend.update((value) {
_routeSend?.update((value) {
if (previousRoute is PageRoute) {
value.current = previousRoute?.settings?.name ?? '';
}
... ... @@ -142,7 +142,7 @@ class GetObserver extends NavigatorObserver {
GetConfig.currentRoute = name(newRoute);
_routeSend.update((value) {
_routeSend?.update((value) {
if (newRoute is PageRoute) value.current = newRoute?.settings?.name ?? '';
value.args = newRoute?.settings?.arguments;
value.route = newRoute;
... ... @@ -161,7 +161,7 @@ class GetObserver extends NavigatorObserver {
super.didRemove(route, previousRoute);
GetConfig.log("REMOVING ROUTE ${route?.settings?.name}");
_routeSend.update((value) {
_routeSend?.update((value) {
value.route = previousRoute;
value.isBack = false;
value.removed = route?.settings?.name ?? '';
... ...
name: get
description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX.
version: 3.8.0
version: 3.10.0
homepage: https://github.com/jonataslaw/get
environment:
... ...