Jonny Borges
Committed by GitHub

Add files via upload

@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 A consistent navigation library that lets you navigate between screens, open dialogs/bottomSheets, and display snackbars from anywhere in your code without context. 3 A consistent navigation library that lets you navigate between screens, open dialogs/bottomSheets, and display snackbars from anywhere in your code without context.
4 ## Getting Started 4 ## Getting Started
5 5
  6 +*Languages: [English](README.md), [Brazilian Portuguese](README.pt-br.md).*
  7 +
6 Flutter's conventional navigation has a lot of unnecessary boilerplate, requires context to navigate between screens, open dialogs, and use snackbars on framework is really painful. 8 Flutter's conventional navigation has a lot of unnecessary boilerplate, requires context to navigate between screens, open dialogs, and use snackbars on framework is really painful.
7 In addition, when a route is pushed, the entire MaterialApp can be rebuilt causing freezes, this does not happen with Get. 9 In addition, when a route is pushed, the entire MaterialApp can be rebuilt causing freezes, this does not happen with Get.
8 This library that will change the way you work with the Framework and save your life from cliche code, increasing your productivity, and eliminating the rebuild bugs of your application. 10 This library that will change the way you work with the Framework and save your life from cliche code, increasing your productivity, and eliminating the rebuild bugs of your application.
@@ -21,17 +23,13 @@ Navigator.of(context).push( @@ -21,17 +23,13 @@ Navigator.of(context).push(
21 // Get sintax 23 // Get sintax
22 Get.to(Home()); 24 Get.to(Home());
23 ``` 25 ```
24 -  
25 -##### If you use master/dev/beta branch of Flutter, use the version 1.20.0-dev.  
26 -* If you use MODULAR, add on your MaterialApp this: navigatorKey: Get.addKey(Modular.navigatorKey)  
27 -  
28 ## How to use? 26 ## How to use?
29 27
30 Add this to your package's pubspec.yaml file: 28 Add this to your package's pubspec.yaml file:
31 29
32 ``` 30 ```
33 dependencies: 31 dependencies:
34 - get: ^1.17.0 // ^1.20.0-dev on beta/dev/master 32 + get: ^1.17.2 // ^1.20.0-dev on beta/dev/master
35 ``` 33 ```
36 34
37 And import it: 35 And import it:
@@ -275,9 +273,14 @@ And then you will be able to recover your controller data that was obtained back @@ -275,9 +273,14 @@ And then you will be able to recover your controller data that was obtained back
275 Text(controller.textFromApi); 273 Text(controller.textFromApi);
276 ``` 274 ```
277 275
  276 +To remove a instance of Get:
  277 +```dart
  278 +Controller controller = Get.delete(Controller());
  279 +```
  280 +
  281 +
278 ## Navigate with named routes: 282 ## Navigate with named routes:
279 -- Yes, and with no navigation bug, add "named" to Get. HOWEVER, TO MAKE THIS TYPE OF NAVIGATION, USE THE ROUTE MODEL FROM REPOSITORY.  
280 -Example of navigation with named routes: 283 +- If you prefer to browse selected routes, or Get also supports this.
281 284
282 To navigate to nextScreen 285 To navigate to nextScreen
283 ```dart 286 ```dart
@@ -292,9 +295,9 @@ To navigate and remove all previous screens from the tree. @@ -292,9 +295,9 @@ To navigate and remove all previous screens from the tree.
292 Get.offAllNamed("/NextScreen"); 295 Get.offAllNamed("/NextScreen");
293 ``` 296 ```
294 297
295 -## Using with Named Routes and And offering full flutter_web support (REQUIRED FOR NAMED ROUTES): 298 +## Configure the Named Routes and And offering full flutter_web support to friendly urls:
296 299
297 -### Add " navigatorKey: Get.key," to MaterialApp 300 +### If you have not yet added "navigatorKey: Get.key," to your MaterialApp, do it now. Take the opportunity to add an "initialRoute" and your "onGenerateRoute".
298 301
299 ```dart 302 ```dart
300 void main() { 303 void main() {
@@ -306,40 +309,7 @@ void main() { @@ -306,40 +309,7 @@ void main() {
306 )); 309 ));
307 } 310 }
308 ``` 311 ```
309 -#### Middleware  
310 -If you want listen Get events to trigger actions, you can add a GetObserver to your materialApp. This is extremely useful for triggering events whenever a specific Screen is displayed on the screen. Currently on Flutter you would have to put the event on initState and wait for a possible response in a navigator.pop (context); to get that. But with Get, this is extremely simple!  
311 -  
312 -##### add GetObserver();  
313 -```dart  
314 -void main() {  
315 - runApp(MaterialApp(  
316 - onGenerateRoute: Router.generateRoute,  
317 - initialRoute: "/",  
318 - navigatorKey: Get.key,  
319 - navigatorObservers: [  
320 - GetObserver(MiddleWare.observer), // HERE !!!  
321 - ],  
322 - ));  
323 -}  
324 -```  
325 -Create a MiddleWare class  
326 -  
327 -```dart  
328 -class MiddleWare {  
329 - static observer(Routing routing) {  
330 - /// You can listen in addition to the routes, the snackbars, dialogs and bottomsheets on each screen.  
331 - ///If you need to enter any of these 3 events directly here,  
332 - ///you must specify that the event is != Than you are trying to do.  
333 - if (routing.current == '/second' && !routing.isSnackbar) {  
334 - Get.snackbar("Hi", "You are on second route");  
335 - } else if (routing.current =='/third'){  
336 - print('last route called');  
337 - }  
338 - }  
339 -}  
340 -```  
341 312
342 -### COPY THE ROUTER CLASS BELOW:  
343 Copy this Router class below and put it in your app, rename routes and classes for your own, add more classes to it if necessary. 313 Copy this Router class below and put it in your app, rename routes and classes for your own, add more classes to it if necessary.
344 314
345 ```dart 315 ```dart
@@ -373,7 +343,43 @@ class Router { @@ -373,7 +343,43 @@ class Router {
373 } 343 }
374 ``` 344 ```
375 345
376 -And now, all you need to do is use Get.toNamed() to navigate your named routes, without any context (you can call your routes directly from your BLoC or Controller class), and when your app is compiled to the web, your routes will appear in the url beautifully <3 346 +And now, all you need to do is use Get.toNamed() to navigate your named routes, without any context (you can call your routes directly from your BLoC or Controller class), and when your app is compiled to the web, your routes will appear in the url <3
  347 +
  348 +
  349 +#### Middleware
  350 +If you want listen Get events to trigger actions, you can add a GetObserver to your materialApp. This is extremely useful for triggering events whenever a specific Screen is displayed on the screen. Currently on Flutter you would have to put the event on initState and wait for a possible response in a navigator.pop (context); to get that. But with Get, this is extremely simple!
  351 +
  352 +##### add GetObserver();
  353 +```dart
  354 +void main() {
  355 + runApp(MaterialApp(
  356 + onGenerateRoute: Router.generateRoute,
  357 + initialRoute: "/",
  358 + navigatorKey: Get.key,
  359 + navigatorObservers: [
  360 + GetObserver(MiddleWare.observer), // HERE !!!
  361 + ],
  362 + ));
  363 +}
  364 +```
  365 +Create a MiddleWare class
  366 +
  367 +```dart
  368 +class MiddleWare {
  369 + static observer(Routing routing) {
  370 + /// You can listen in addition to the routes, the snackbars, dialogs and bottomsheets on each screen.
  371 + ///If you need to enter any of these 3 events directly here,
  372 + ///you must specify that the event is != Than you are trying to do.
  373 + if (routing.current == '/second' && !routing.isSnackbar) {
  374 + Get.snackbar("Hi", "You are on second route");
  375 + } else if (routing.current =='/third'){
  376 + print('last route called');
  377 + }
  378 + }
  379 +}
  380 +```
  381 +
  382 +Now, use Get on your code:
377 383
378 ```dart 384 ```dart
379 class First extends StatelessWidget { 385 class First extends StatelessWidget {
@@ -551,6 +557,7 @@ Get.height / Get.width // Equivalent to the method: MediaQuery.of(context).size. @@ -551,6 +557,7 @@ Get.height / Get.width // Equivalent to the method: MediaQuery.of(context).size.
551 557
552 Get.context // Gives the context of the screen in the foreground anywhere in your code. 558 Get.context // Gives the context of the screen in the foreground anywhere in your code.
553 559
  560 +Get.contextOverlay // Gives the context of the snackbar/dialog/bottomsheet in the foreground anywhere in your code.
554 561
555 ``` 562 ```
556 563
  1 +# Get
  2 +
  3 +Uma biblioteca de navegação completa que permite navegar entre telas, abrir caixas de diálogo, bottomSheets e exibir snackbars de qualquer lugar do seu código, sem precisar usar context.
  4 +## Ponto de partida
  5 +
  6 +*Idiomas: [Inglês](README.md), [Português](README.pt-br.md).*
  7 +
  8 +A navegação convencional do Flutter possui muito código clichê desnecessário, requer contexto para navegar entre telas, abrir caixas de diálogo e usar snackbars em seu projeto pode ser algo desgastante.
  9 +Além disso, quando uma rota é enviada por push, todo o MaterialApp pode ser reconstruído causando congelamentos, bem, isso não acontece com o Get.
  10 +Essa biblioteca que mudará a maneira como você trabalha com o Framework e salvará sua vida do código clichê, aumentando sua produtividade e eliminando os erros de reconstrução do seu aplicativo, além de um conjunto de APIs não disponíveis na biblioteca padrão do Flutter.
  11 +
  12 +
  13 +```dart
  14 +// Navegação padrão do Flutter:
  15 +Navigator.of(context).push(
  16 + context,
  17 + MaterialPageRoute(
  18 + builder: (BuildContext context) {
  19 + return HomePage();
  20 + },
  21 + ),
  22 + );
  23 +
  24 +// Como fazer o mesmo com o Get:
  25 +Get.to(Home());
  26 +```
  27 +
  28 +##### Se você está na branch master/dev/beta do Flutter, use a versão 1.20.0-dev.
  29 +* Se você usa Modular, adicione ao seu MaterialApp: navigatorKey: Get.addKey(Modular.navigatorKey)
  30 +
  31 +## Como usar?
  32 +
  33 +Adicione esse pacote ao seu arquivo pubspec.yaml:
  34 +
  35 +```
  36 +dependencies:
  37 + get: ^1.17.1s // ^1.20.0-dev on beta/dev/master
  38 +```
  39 +
  40 +Importe ele se seu IDE não fizer isso de forma automática:
  41 +```dart
  42 +import 'package:get/get.dart';
  43 +```
  44 +Adicione GetKey ao seu MaterialApp e aproveite!
  45 +```dart
  46 +MaterialApp(
  47 + navigatorKey: Get.key,
  48 + home: MyHome(),
  49 + )
  50 +```
  51 +### Navegando sem rotas nomeadas
  52 +Para ir para outra tela:
  53 +
  54 +```dart
  55 +Get.to(NextScreen());
  56 +```
  57 +
  58 +Para voltar para a tela anterior
  59 +
  60 +```dart
  61 +Get.back();
  62 +```
  63 +
  64 +Para ir para a próxima tela e tirar a rota atual da stack de navegação (uso comum em SplashScreens, telas de cadastros e qualquer outra tela que você não deseja exibir quando clicar em voltar)
  65 +
  66 +```dart
  67 +Get.off(NextScreen());
  68 +```
  69 +
  70 +Ir para a próxima tela e tirar todas as telas anteriores da stack de navegação (geralmente usado em carrinhos de compras, provas, enquetes e etc)
  71 +
  72 +```dart
  73 +Get.offAll(NextScreen());
  74 +```
  75 +
  76 +Para navegar para uma rota e receber ou atualizar dados assim que voltar dela:
  77 +```dart
  78 +var data = await Get.to(Payment());
  79 +```
  80 +Na próxima tela, envie algum dado para a screen anterior ao voltar (pode ser qualquer coisa, Strings, int, Maps, até instâncias de classes, você pode tudo):
  81 +
  82 +```dart
  83 +Get.back(result: 'sucess');
  84 +```
  85 +E você pode usar o dado recebido assim:
  86 +
  87 +ex:
  88 +```dart
  89 +if(data == 'sucess') madeAnything();
  90 +```
  91 +
  92 +Você não quer aprender nossa sintaxe?
  93 +Basta alterar o Navigator (maiúsculo) para navigator (minúsculo) e você terá todas as funções da navegação padrão, sem precisar usar o contexto
  94 +Exemplo:
  95 +
  96 +```dart
  97 +
  98 +// Navegação padrão
  99 +Navigator.of(context).push(
  100 + context,
  101 + MaterialPageRoute(
  102 + builder: (BuildContext context) {
  103 + return HomePage();
  104 + },
  105 + ),
  106 + );
  107 +
  108 +// Usando Get com a sintaxe do Flutter
  109 +navigator.push(
  110 + MaterialPageRoute(
  111 + builder: (_) {
  112 + return HomePage();
  113 + },
  114 + ),
  115 + );
  116 +
  117 +// Usando a sintaxe do Get (Muito melhor, mas você pode discordar disso)
  118 +Get.to(HomePage());
  119 +
  120 +
  121 +```
  122 +
  123 +### SnackBars
  124 +
  125 +Para ter uma simples SnackBar com Flutter, você deve obter o contexto do Scaffold ou usar uma GlobalKey anexada ao seu Scaffold,
  126 +```dart
  127 +final snackBar = SnackBar(
  128 + content: Text('Oi!'),
  129 + action: SnackBarAction(
  130 + label: 'Eu sou uma velha e feia snackbar :(',
  131 + onPressed: (){}
  132 + ),
  133 + // Find the Scaffold in the widget tree and use
  134 + // it to show a SnackBar.
  135 + Scaffold.of(context).showSnackBar(snackBar);
  136 +```
  137 +
  138 +Já com o Get:
  139 +
  140 +```dart
  141 +Get.snackbar('Oi', 'Eu sou uma snackbar bonita e moderna');
  142 +```
  143 +
  144 +Com o Get, tudo o que você precisa fazer é chamar o Get.snackbar de qualquer lugar no seu código ou personalizá-lo como quiser!
  145 +
  146 +```dart
  147 + Get.snackbar(
  148 + "Hey i'm a Get SnackBar!", // title
  149 + "It's unbelievable! I'm using SnackBar without context, without boilerplate, without Scaffold, it is something truly amazing!", // message
  150 + icon: Icon(Icons.alarm),
  151 + shouldIconPulse: true,
  152 + onTap:(){},
  153 + barBlur: 20,
  154 + isDismissible: true,
  155 + duration: Duration(seconds: 3),
  156 + );
  157 +
  158 +
  159 + ////////// TODOS RECURSOS //////////
  160 + // Color colorText,
  161 + // Duration duration,
  162 + // SnackPosition snackPosition,
  163 + // Widget titleText,
  164 + // Widget messageText,
  165 + // Widget icon,
  166 + // bool shouldIconPulse,
  167 + // double maxWidth,
  168 + // EdgeInsets margin,
  169 + // EdgeInsets padding,
  170 + // double borderRadius,
  171 + // Color borderColor,
  172 + // double borderWidth,
  173 + // Color backgroundColor,
  174 + // Color leftBarIndicatorColor,
  175 + // List<BoxShadow> boxShadows,
  176 + // Gradient backgroundGradient,
  177 + // FlatButton mainButton,
  178 + // OnTap onTap,
  179 + // bool isDismissible,
  180 + // bool showProgressIndicator,
  181 + // AnimationController progressIndicatorController,
  182 + // Color progressIndicatorBackgroundColor,
  183 + // Animation<Color> progressIndicatorValueColor,
  184 + // SnackStyle snackStyle,
  185 + // Curve forwardAnimationCurve,
  186 + // Curve reverseAnimationCurve,
  187 + // Duration animationDuration,
  188 + // double barBlur,
  189 + // double overlayBlur,
  190 + // Color overlayColor,
  191 + // Form userInputForm
  192 + ///////////////////////////////////
  193 +```
  194 +Após a recusa de um aplicativo na AppleStore por usar a snackbar padrão que não combina nada com as Human Guidelines da Apple, resolvi criar a Get.snackbar, mas se você prefere a snackbar padrão, ou não desenvolve para iOS, você pode usar a API de baixo nível `GetBar().show();` que permite por exemplo, excluir a mensagem (Get.snackbar tem título e mensagem obrigatórios).
  195 +
  196 +### Caixas de dialogos
  197 +
  198 +Para abrir uma caixa de diálogo:
  199 +
  200 +```dart
  201 +Get.dialog(YourDialogWidget());
  202 +```
  203 +
  204 +Para abrir o dialogo padrão do Get:
  205 +
  206 +```dart
  207 + Get.defaultDialog(
  208 + title: "My Title",
  209 + content: Text("Hi, it's my dialog"),
  210 + confirm: FlatButton(
  211 + child: Text("Ok"),
  212 + onPressed: () => print("OK pressed"),
  213 + ),
  214 + cancel: FlatButton(
  215 + child: Text("Cancel"),
  216 + onPressed: () => Get.back(),
  217 + ));
  218 +```
  219 +
  220 +### BottomSheets
  221 +Get.bottomSheet é como showModalBottomSheet, mas não precisa de context.
  222 +
  223 +```dart
  224 +Get.bottomSheet(
  225 + builder: (_){
  226 + return Container(
  227 + child: Wrap(
  228 + children: <Widget>[
  229 + ListTile(
  230 + leading: Icon(Icons.music_note),
  231 + title: Text('Music'),
  232 + onTap: () => {}
  233 + ),
  234 + ListTile(
  235 + leading: Icon(Icons.videocam),
  236 + title: Text('Video'),
  237 + onTap: () => {},
  238 + ),
  239 + ],
  240 + ),
  241 + );
  242 + }
  243 + );
  244 +```
  245 +### Configurações Globais
  246 +Você pode criar configurações globais para o Get. Basta adicionar Get.config ao seu código antes de enviar qualquer rota. (Se não souber onde colocar, coloque dentro da função main())
  247 +
  248 +```dart
  249 +Get.config(
  250 + enableLog = true,
  251 + defaultPopGesture = true,
  252 + defaultTransition = Transitions.cupertino}
  253 +```
  254 +
  255 +## Gerenciador de instâncias descomplicado
  256 +Além de aumentar produtividade, muita gente usa Get para ter um aplicativo menor. Se você tem várias rotas e snackbars em seu aplicativo, ele provavelmente terá um código final maior que seu aplicativo + essa biblioteca
  257 +Se você já está usando o Get e deseja tornar seu projeto o mais enxuto possível, agora o Get possui um gerenciador de instancias simples que permite recuperar a mesma classe do seu Bloc ou Controller com apenas 1 linhas de código.
  258 +
  259 +```dart
  260 +Controller controller = Get.put(Controller()); // Em vez de Controller controller = Controller();
  261 +```
  262 +Em vez de instanciar seu controlador dentro da classe que você está usando, use o metodo put para que o Get pegue sua instância e disponibilize por todo o seu aplicativo.
  263 +Então você pode usar seu controlador (ou classe Bloc) normalmente.
  264 +
  265 +```dart
  266 +controller.fetchApi();// Rather Controller controller = Controller();
  267 +```
  268 +
  269 +Agora, imagine que você navegou por inúmeras rotas e precisa de dados que foram deixados para trás em seu controlador; você precisaria de um gerenciador de estado combinado com o Provider ou Get_it, correto? Não com Get. Você só precisa pedir ao Get para "procurar" pelo seu controlador, você não precisa de nenhuma dependência adicional para isso:
  270 +
  271 +```dart
  272 +Controller controller = Get.find(Controller());
  273 +```
  274 +E então você poderá recuperar os dados do seu controlador obtidos lá:
  275 +
  276 +```dart
  277 +Text(controller.textFromApi);
  278 +```
  279 +
  280 +Quer liberar recursos? Para remover uma instância do Get, apenas delete ela:
  281 +
  282 +```dart
  283 +Controller controller = Get.delete(Controller());
  284 +```
  285 +Pronto, você consegue fazer mais com menos código, diminuiu o tamanho de código do seu app, e agora tem um gerenciador de instâncias ultra leve, com apenas 1 biblioteca.
  286 +
  287 +## Navegando com rotas nomeadas:
  288 +- Se você prefere navegar por rotas nomeadas, o Get também dá suporte a isso.
  289 +
  290 +Para navegar para uma nova tela
  291 +```dart
  292 +Get.toNamed("/NextScreen");
  293 +```
  294 +Para navegar para uma tela sem a opção de voltar para a rota atual.
  295 +```dart
  296 +Get.offNamed("/NextScreen");
  297 +```
  298 +Para navegar para uma nova tela e remover todas rotas anteriores da stack
  299 +```dart
  300 +Get.offAllNamed("/NextScreen");
  301 +```
  302 +
  303 +## Configurando rotas nomeadas e adicionando suporte completo à urls amigáveis do Flutter Web
  304 +
  305 +### Se você ainda não adicionou " navigatorKey: Get.key," ao seu MaterialApp, faça agora. aproveite para adicionar uma "initialRoute" e o seu "onGenerateRoute".
  306 +
  307 +```dart
  308 +void main() {
  309 + runApp(MaterialApp(
  310 + onGenerateRoute: Router.generateRoute,
  311 + initialRoute: "/",
  312 + navigatorKey: Get.key,
  313 + title: 'Navigation',
  314 + ));
  315 +}
  316 +```
  317 +Crie uma classe para gerenciar suas rotas nomeadas, você pode (e deve) copiar esse exemplo
  318 +
  319 +```dart
  320 +class Router {
  321 + static Route<dynamic> generateRoute(RouteSettings settings) {
  322 + switch (settings.name) {
  323 + case '/':
  324 + return GetRoute(
  325 + page: First(),
  326 + settings: settings,
  327 + );
  328 + case '/second':
  329 + return GetRoute(
  330 + settings: settings, page: Second(), transition: Transition.fade);
  331 + case '/third':
  332 + return GetRoute(
  333 + settings: settings,
  334 + page: Third(),
  335 + popGesture: true,
  336 + transition: Transition.cupertino);
  337 + default:
  338 + return GetRoute(
  339 + settings: settings,
  340 + transition: Transition.fade,
  341 + page: Scaffold(
  342 + body:
  343 + Center(child: Text('No route defined for ${settings.name}')),
  344 + ));
  345 + }
  346 + }
  347 +}
  348 +```
  349 +
  350 +E agora, tudo que você precisa fazer é usar Get.toNamed() para navegar pelas rotas nomeadas, sem qualquer context (você pode chamar suas rotas diretamente da sua classe BLoC ou Controller) e, quando o aplicativo for compilado na Web, suas rotas aparecerão na URL <3
  351 +
  352 +#### Middleware
  353 +Se você deseja ouvir eventos de navegação para acionar ações, é possível adicionar um GetObserver ao seu materialApp. Isso é extremamente útil para acionar eventos sempre que uma tela específica é exibida na tela. Atualmente no Flutter, você teria que colocar o evento no initState e aguardar uma possível resposta em um navigator.pop (context); para conseguir isso. Mas com o Get, isso é extremamente simples!
  354 +
  355 +##### add GetObserver();
  356 +```dart
  357 +void main() {
  358 + runApp(MaterialApp(
  359 + onGenerateRoute: Router.generateRoute,
  360 + initialRoute: "/",
  361 + navigatorKey: Get.key,
  362 + navigatorObservers: [
  363 + GetObserver(MiddleWare.observer), // HERE !!!
  364 + ],
  365 + ));
  366 +}
  367 +```
  368 +Create a MiddleWare class
  369 +
  370 +```dart
  371 +class MiddleWare {
  372 + static observer(Routing routing) {
  373 + /// Você pode ouvir além das rotas, snackbars, caixas de diálogo e bottomsheets em cada tela.
  374 + /// Se você precisar inserir qualquer um desses 3 eventos diretamente aqui,
  375 +   /// você deve especificar que o evento é != Do que você está tentando fazer ou você terá um loop.
  376 + if (routing.current == '/second' && !routing.isSnackbar) {
  377 + Get.snackbar("Hi", "You are on second route");
  378 + } else if (routing.current =='/third'){
  379 + print('last route called');
  380 + }
  381 + }
  382 +}
  383 +```
  384 +Agora é só usar o Get em seu código:
  385 +
  386 +```dart
  387 +class First extends StatelessWidget {
  388 + @override
  389 + Widget build(BuildContext context) {
  390 + return Scaffold(
  391 + appBar: AppBar(
  392 + leading: IconButton(
  393 + icon: Icon(Icons.add),
  394 + onPressed: () {
  395 + Get.snackbar("hi", "i am a modern snackbar");
  396 + },
  397 + ),
  398 + title: Text('First Route'),
  399 + ),
  400 + body: Center(
  401 + child: RaisedButton(
  402 + child: Text('Open route'),
  403 + onPressed: () {
  404 + Get.toNamed("/second");
  405 + },
  406 + ),
  407 + ),
  408 + );
  409 + }
  410 +}
  411 +
  412 +class Second extends StatelessWidget {
  413 + @override
  414 + Widget build(BuildContext context) {
  415 + return Scaffold(
  416 + appBar: AppBar(
  417 + leading: IconButton(
  418 + icon: Icon(Icons.add),
  419 + onPressed: () {
  420 + Get.snackbar("hi", "i am a modern snackbar");
  421 + },
  422 + ),
  423 + title: Text('second Route'),
  424 + ),
  425 + body: Center(
  426 + child: RaisedButton(
  427 + child: Text('Open route'),
  428 + onPressed: () {
  429 + Get.toNamed("/third");
  430 + },
  431 + ),
  432 + ),
  433 + );
  434 + }
  435 +}
  436 +
  437 +class Third extends StatelessWidget {
  438 + @override
  439 + Widget build(BuildContext context) {
  440 + return Scaffold(
  441 + appBar: AppBar(
  442 + title: Text("Third Route"),
  443 + ),
  444 + body: Center(
  445 + child: RaisedButton(
  446 + onPressed: () {
  447 + Get.back();
  448 + },
  449 + child: Text('Go back!'),
  450 + ),
  451 + ),
  452 + );
  453 + }
  454 +}
  455 +```
  456 +
  457 +
  458 +### APIs Avançadas
  459 +A cada dia, o Get fica mais longe do Framework padrão e fornece uma gama mais ampla de recursos que são impensáveis de serem executados usando o Flutter padrão.
  460 +Com o Get 1.17.0, foi lançada uma série de novas APIs, que permitem por exemplo, o acesso dos argumentos de uma rota nomeada de qualquer lugar do código, se há alguma snackbar ou caixa de diálogo aberta naquele momento ou qual tela está sendo exibida para o usuário.
  461 +Este é um grande passo para desanexar completamente a navegação Flutter de InheritedWidgets. Usar o contexto para acessar o InheritedWidget para usar um recurso simples de navegação é uma das únicas coisas chatas que se pode encontrar nessa estrutura incrível que é o Flutter. Agora, o Get resolveu esse problema, tornou-se onisciente e você terá acesso a basicamente qualquer ferramenta do Flutter que está disponível apenas na árvore de widgets usando o Get.
  462 +
  463 +Todas as APIs disponíveis aqui estão na fase beta; elas são totalmente funcionais, passaram em testes internos, mas como foram recém lançadas, não tem maturidade suficiente para garantir sua estabilidade. Get é totalmente estável (quase sempre issues abertas são solicitações de recursos, quase nunca bugs), mas esse conjunto de APIs foi lançado recentemente, portanto, se você encontrar algum erro aqui, abra um problema ou ofereça um PR.
  464 +
  465 +- Obrigatório: para ter acesso a essa API, você deve obrigatoriamente inserir o GetObserver em seu MaterialApp
  466 +
  467 +```dart
  468 +MaterialApp(
  469 + navigatorKey: Get.key,
  470 + navigatorObservers: [GetObserver()], // COLOQUE AQUI !!!!
  471 + );
  472 +```
  473 +
  474 +Você também poderá usar seu próprio Middleware no GetObserver, isso não influenciará em nada.
  475 +
  476 +```dart
  477 +MaterialApp(
  478 + navigatorKey: Get.key,
  479 + navigatorObservers: [GetObserver(MiddleWare.observer)], // AQUI
  480 + );
  481 +```
  482 +
  483 +Principais APIs:
  484 +
  485 +```dart
  486 +Get.arguments // Te dá os argumentos da rota aberta em qualquer lugar do seu código.
  487 + // você não precisa mais recebê-los, inicializa-los no seu initState e enviar por parâmetro ao seu controller/Bloc, Get é onisciente, ele sabe exatamente qual rota está aberta e quais argumentos enviados para ela. Você pode usar isso diretamente no seu controller/bloc sem medo.
  488 +
  489 +Get.previousArguments // Te dá os argumentos da rota anterior.
  490 +
  491 +Get.previousRoute // Te dá o nome da rota anterior
  492 +
  493 +Get.rawRoute // te dá acesso à rota crua, para explorar APIs de baixo nível
  494 +
  495 +Get.routing // te dá acesso à Rounting API do GetObserver
  496 +
  497 +Get.isSnackbarOpen // verifique se a snackbar está sendo exibida na tela
  498 +
  499 +Get.isDialogOpen // verifique se a caixa de diálogo está sendo exibida na tela
  500 +
  501 +Get.isBottomSheetOpen // verifique se a bottomsheet está sendo exibida na tela
  502 +
  503 +
  504 +```
  505 +### Nested Navigators
  506 +
  507 +Get fez a navegação aninhada do Flutter ainda mais fácil.
  508 +Você não precisa do contexto e encontrará sua pilha de navegação por um ID exclusivo.
  509 +
  510 +Veja como é simples:
  511 +
  512 +```dart
  513 + Navigator(
  514 + key: nestedKey(1), // crie sua key por um index
  515 + initialRoute: '/',
  516 + onGenerateRoute: (settings) {
  517 + if (settings.name == '/') {
  518 + return GetRoute(
  519 + page: Scaffold(
  520 + appBar: AppBar(
  521 + title: Text("Main"),
  522 + ),
  523 + body: Center(
  524 + child: FlatButton(
  525 + color: Colors.blue,
  526 + onPressed: () {
  527 + Get.toNamed('/second', 1); // navegue por sua rota aninhada usando o index
  528 + },
  529 + child: Text("Go to second")),
  530 + ),
  531 + ),
  532 + );
  533 + } else if (settings.name == '/second') {
  534 + return GetRoute(
  535 + page: Center(
  536 + child: Scaffold(
  537 + appBar: AppBar(
  538 + title: Text("Main"),
  539 + ),
  540 + body: Center(
  541 + child: Text("second")
  542 + ),
  543 + ),
  544 + ),
  545 + );
  546 + }
  547 + }),
  548 +```
  549 +
  550 +
  551 +### Outras APIs:
  552 +Desde quando essa biblioteca foi criada, reuni meus esforços para adicionar novos recursos e torná-la mais estável possível. Com isso, ainda há algumas APIs disponíveis que ainda não foram documentadas. Meu tempo é escasso, então vou resumir as principais aqui:
  553 +
  554 +```dart
  555 +Get.removeRoute() // remove uma rota
  556 +
  557 +Get.until() // volta repetidamente até o predicado ser verdadeiro
  558 +
  559 +Get.offUntil() // vá para a próxima rota e remova todas as rotas anteriores até que o predicado retornar verdadeiro.
  560 +
  561 +Get.offNamedUntil() // vá para a próxima rota nomeada e remova todas as rotas anteriores até que o predicado retorne verdadeiro (namedRoutes)
  562 +
  563 +GetPlatform.isAndroid/isIOS/isWeb... //(Este método é totalmente compatível com o FlutterWeb, diferente do padrão "Platform.isAndroid" que usa dart:io)
  564 +
  565 +Get.height / Get.width // Equivalente ao método: MediaQuery.of(context).size.height //width
  566 +
  567 +Get.context // Fornece o contexto da tela em primeiro plano em qualquer lugar do seu código.
  568 +
  569 +Get.overlayContext // Fornece o contexto do dialogo/snackbar/bottomsheet em primeiro plano em qualquer lugar do seu código.
  570 +
  571 +
  572 +```
  573 +
  574 +Essa biblioteca será sempre atualizada e implementando novos recursos. Sinta-se livre para oferecer PRs e contribuir com ela.