@@ -29,7 +29,7 @@ Add this to your package's pubspec.yaml file:
```
dependencies:
get: ^1.17.2 // ^1.20.0-dev on beta/dev/master
get: ^1.17.3 // ^1.20.0-dev on beta/dev/master
```
And import it:
...
...
@@ -262,10 +262,11 @@ So you can use your controller (or class Bloc) normally
controller.fetchApi();// Rather Controller controller = Controller();
```
Imagine that you have navigated through numerous routes, and you need a data that was left behind in your controller, you would need a state manager combined with the Provider or Get_it, correct? Not with Get. You just need to ask Get to "search" for your controller, you don't need any additional dependencies:
Imagine that you have navigated through numerous routes, and you need a data that was left behind in your controller, you would need a state manager combined with the Provider or Get_it, correct? Not with Get. You just need to ask Get to "find" for your controller, you don't need any additional dependencies:
```dart
Controller controller = Get.find(Controller());
Controller controller = Get.find();
//Yes, it looks like Magic, Get will find your controller, and will deliver it to you. You can have 1 million controllers instantiated, Get will always give you the right controller.
```
And then you will be able to recover your controller data that was obtained back there:
...
...
@@ -275,7 +276,7 @@ Text(controller.textFromApi);
To remove a instance of Get:
```dart
Controller controller = Get.delete(Controller());
Get.delete(Controller());
```
...
...
@@ -295,6 +296,19 @@ To navigate and remove all previous screens from the tree.
Get.offAllNamed("/NextScreen");
```
### Send data to named Routes:
Just send what you want for arguments. Get accepts anything here, whether it is a String, a Map, a List, or even a class instance.
```dart
Get.toNamed("/NextScreen", arguments: 'Get is the best');
```
on your class or controller:
```dart
print(Get.arguments);
//print out: Get is the best
```
## Configure the Named Routes and And offering full flutter_web support to friendly urls:
### 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".
@@ -34,7 +34,7 @@ Adicione esse pacote ao seu arquivo pubspec.yaml:
```
dependencies:
get: ^1.17.1s // ^1.20.0-dev on beta/dev/master
get: ^1.17.3 // ^1.20.0-dev on beta/dev/master
```
Importe ele se seu IDE não fizer isso de forma automática:
...
...
@@ -269,7 +269,8 @@ controller.fetchApi();// Rather Controller controller = Controller();
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:
```dart
Controllercontroller=Get.find(Controller());
Controllercontroller=Get.find();
// Sim, parece Magia, o Get irá descobrir qual é seu controller, e irá te entregar. Você pode ter 1 milhão de controllers instanciados, o Get sempre te entregará o controller correto. Apenas se lembre de Tipar seu controller, final controller = Get.find(); por exemplo, não irá funcionar.
```
E então você poderá recuperar os dados do seu controlador obtidos lá:
...
...
@@ -300,6 +301,19 @@ Para navegar para uma nova tela e remover todas rotas anteriores da stack
Get.offAllNamed("/NextScreen");
```
### Enviando dados por rotas nomeadas:
Apenas envie o que você quiser por argumentos. Get aceita qualquer coisa aqui, não importa se é uma String, um Map, uma List, int ou até uma instancia de classe.
```dart
Get.toNamed("/NextScreen",arguments:'Get is the best');
```
Agora você pode recuperar em sua classe ou em seu controller:
```dart
print(Get.arguments);
//print out: Get is the best
```
## Configurando rotas nomeadas e adicionando suporte completo à urls amigáveis do Flutter Web
### Se você ainda não adicionou " navigatorKey: Get.key," ao seu MaterialApp, faça agora. aproveite para adicionar uma "initialRoute" e o seu "onGenerateRoute".