@@ -791,7 +791,7 @@ The Binding class is called when a route is called, you can create an "initialBi
```dart
GetMaterialApp(
initialBinding:SampleBind(),
home:Home();
home:Home(),
);
```
...
...
@@ -799,7 +799,7 @@ If you want to use your initializations in one place, you can use SmartManagemen
I always prefer the standard SmartManagement (full). It can be annoying at times, and eliminate something you don't want, as it has refined controls that remove memory dependency even if there is a flaw, and a widget is not arranged properly. It is safe enough with StatelessWidget, since even if there is no page available, it will still remove the controller from memory. But there are some use cases, which this restriction can be bothersome. For these situations you can use SmartManagement.onlyBuilders, which will depend on the effective removal of widgets that use the controller from the tree to remove the controller.
- NOTE: DO NOT USE SmartManagement.keepFactory if you are using multiple Bindings. It was designed to be used without Bindings, or with a single Binding linked in the GetBaterialApp's initialBinding.
- NOTE: DO NOT USE SmartManagement.keepFactory if you are using multiple Bindings. It was designed to be used without Bindings, or with a single Binding linked in the GetMaterialApp's initialBinding.
- NOTE2: Using Bindings is completely optional, you can use Get.put() and Get.find() on classes that use a given controller without any problem.
However, if you work with Services or any other abstraction, I recommend using Bindings for a larger organization.
Então, você não vai precisar se preocupar com gerenciamento da memória da sua aplicação mais, Get vai fazer para você.
A classe Bindings é chamada quando uma rota é chamada. Você pode criar uma Binding inicial no seu GetMaterialApp para inserir todas as dependências que serão criadas.
```dart
GetMaterialApp(
initialBinding:SampleBind(),
home:Home(),
)
```
Se você quiser usar suas inicializações em um lugar, você pode usar `SmartManagement.keepfactory` para permitir isso. E apesar de que usar o keepfactory deve ser uma exceção ao caso, mesmo assim é um dos mais suaves por aí.
Eu sempre prefiro o SmartManagemente padrão (full). Pode ser frustrante as vezes, e eliminar algo que você não queira, já que tem controlers refinados que removem a dependência da memória mesmo que tenha uma falha, e algum widget não esteja organizado propriamente. É seguro o suficiente com o StatelessWidget, já que mesmo que não tenha nenhuma página disponível, ainda sim vai remover o controller da memória. Mas tem uns momentos certos para usar, (which this restriction can be bothersome)???. Para essas situações você pode usar o SmartManagemente.onlyBuilders, que vai depende da remoção efetiva dos widgets que usam o controller da árvore para remover o controller.
- Nota: NÃO USE SmartManagement.keepfactory se você está usando vários Bindings. Ele foi criado para ser usado sem Bindings, ou com um único Binding ligado ao GetMaterialApp lá no `initialBinding`
- Nota²: Usar Bindings é completamente opcional, você pode usar Get.put() e Get.find() em classes que usam o controller sem problemas. Porém, se você trabalhar com Services ou qualquer outra abstração, eu recomendo usar Bindings. Especialmente em grandes empresas.
## Workers
Workers vai te dar suporte, ativando callbacks específicos quando um evento ocorrer.
...
...
@@ -1200,10 +1216,14 @@ Get.offNamedUntil()
//diferente do método do framework "Platform.isAndroid")
GetPlatform.isAndroid/isIOS/isWeb...
// Equivalente ao método: MediaQuery.of(context).size.height
// Equivalente ao método: MediaQuery.of(context).size.height, mas é imutável.
// Se você precisa de um height adaptável (como em navegadores em que a janela pode ser redimensionada)
// você precisa usar 'context.height'
Get.height
// Equivalente ao método: MediaQuery.of(context).size.width
// Equivalente ao método: MediaQuery.of(context).size.width, mas é imutável.
// Se você precisa de um width adaptável (como em navegadores em que a janela pode ser redimensionada)
// você precisa usar 'context.width'
Get.width
// forncece o context da tela em qualquer lugar do seu código.