Jonatas

update to 3.13.2

Showing 88 changed files with 61 additions and 4496 deletions

Too many changes to show.

To preserve performance only 88 of 88+ files are displayed.

1 -{  
2 - // Use o IntelliSense para aprender sobre possíveis atributos.  
3 - // Passe o mouse para ver as descrições dos atributos existentes.  
4 - // Para obter mais informações, visite: https://go.microsoft.com/fwlink/?linkid=830387  
5 - "version": "0.2.0",  
6 - "configurations": [  
7 - {  
8 - "name": "getx",  
9 - "cwd": "getx",  
10 - "request": "launch",  
11 - "type": "dart"  
12 - },  
13 - {  
14 - "name": "example debug",  
15 - "cwd": "getx/example",  
16 - "request": "launch",  
17 - "flutterMode": "debug",  
18 - "type": "dart"  
19 - },  
20 - {  
21 - "name": "example profile",  
22 - "cwd": "getx/example",  
23 - "request": "launch",  
24 - "flutterMode": "profile",  
25 - "type": "dart"  
26 - },  
27 - {  
28 - "name": "example release",  
29 - "cwd": "getx/example",  
30 - "request": "launch",  
31 - "flutterMode": "release",  
32 - "type": "dart"  
33 - },  
34 - {  
35 - "name": "get_core",  
36 - "cwd": "packages/get_core",  
37 - "request": "launch",  
38 - "type": "dart"  
39 - },  
40 - {  
41 - "name": "get_instance",  
42 - "cwd": "packages/get_instance",  
43 - "request": "launch",  
44 - "type": "dart"  
45 - },  
46 - {  
47 - "name": "get_navigation",  
48 - "cwd": "packages/get_navigation",  
49 - "request": "launch",  
50 - "type": "dart"  
51 - },  
52 - {  
53 - "name": "get_rx",  
54 - "cwd": "packages/get_rx",  
55 - "request": "launch",  
56 - "type": "dart"  
57 - },  
58 - {  
59 - "name": "get_state_manager",  
60 - "cwd": "packages/get_state_manager",  
61 - "request": "launch",  
62 - "type": "dart"  
63 - },  
64 - {  
65 - "name": "get_test",  
66 - "cwd": "packages/get_test",  
67 - "request": "launch",  
68 - "type": "dart"  
69 - },  
70 - {  
71 - "name": "get_utils",  
72 - "cwd": "packages/get_utils",  
73 - "request": "launch",  
74 - "type": "dart"  
75 - }  
76 - ]  
77 -}  
  1 +## [3.13.2]
  2 +- Reunification of the package.
  3 +During the 2 week period, we try to keep this package as a compilation of smaller packages. We were successful in separating, getx is well decoupled and it was only necessary to send the internal folders as packages to pub.dev, however, it became very complicated to contribute to the package. This is because it was necessary to clone the repository, replace all pubspec packages with local paths, and after modification, return the original paths to do the PR. With that, the frequency of updates, which was about 4 to 5 days, became almost 2 weeks, and this is not legal for a community as active as Getx, which uses this package precisely in addition to being modern and performance, be constantly improving. This led contributors to the conclusion that getx works best together.
  4 +Additional packages will continue to be maintained, and will have the same base as the main package, however, development will take place in the full and main package, and as the addition of new features or bug fixes arrives, we will migrate to the individual packages . Getx reached the mark of 50 contributors today, more than 1500 likes in the pub, and will continue to make development easy.
  5 +
1 ## [3.13.1] 6 ## [3.13.1]
2 - Remove spaces whitespaces from dart files 7 - Remove spaces whitespaces from dart files
3 - 8 -
1 -![](get.png) 1 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/get.png)
2 2
3 *Idiomas: Español (este archivo), [Lengua china](README.zh-cn.md), [Inglés](README.md), [Portugués de Brasil](README.pt-br.md), [Polaco](README.pl.md).* 3 *Idiomas: Español (este archivo), [Lengua china](README.zh-cn.md), [Inglés](README.md), [Portugués de Brasil](README.pt-br.md), [Polaco](README.pl.md).*
4 4
@@ -13,30 +13,30 @@ @@ -13,30 +13,30 @@
13 </a> 13 </a>
14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a> 14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a>
15 15
16 -![](getx.png) 16 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/getx.png)
17 17
18 <h3>Lamentamos la inconsistencia en la traducción. El paquete GetX se actualiza con bastante frecuencia y es posible que las traducciones a documentos no sean tan rápidas. Entonces, para que esta documentación aún tenga todo el contenido, dejaré aquí todos los textos nuevos sin traducir (considero que es mejor tener los documentos en inglés que no tenerlos), por lo que si alguien quiere traducir, sería de gran ayuda 😁</h3> 18 <h3>Lamentamos la inconsistencia en la traducción. El paquete GetX se actualiza con bastante frecuencia y es posible que las traducciones a documentos no sean tan rápidas. Entonces, para que esta documentación aún tenga todo el contenido, dejaré aquí todos los textos nuevos sin traducir (considero que es mejor tener los documentos en inglés que no tenerlos), por lo que si alguien quiere traducir, sería de gran ayuda 😁</h3>
19 19
20 - [Communication and support channels:](#communication-and-support-channels) 20 - [Communication and support channels:](#communication-and-support-channels)
21 - [Sobre GetX](#sobre-getx) 21 - [Sobre GetX](#sobre-getx)
22 - [Como contribuir](#como-contribuir) 22 - [Como contribuir](#como-contribuir)
23 -- [Instalando](#installing)  
24 -- [Proyecto Counter en GetX](#proyeto-counter-no-getx) 23 +- [Installing](#installing)
  24 +- [Proyecto Counter no GetX](#proyecto-counter-no-getx)
25 - [Los tres pilares](#los-tres-pilares) 25 - [Los tres pilares](#los-tres-pilares)
26 - [Gestión del Estado](#gestión-del-estado) 26 - [Gestión del Estado](#gestión-del-estado)
27 - - [STATE_MANAGER Reactivo](#reactivo-state_manager) 27 + - [Reactivo STATE_MANAGER](#reactivo-state_manager)
28 - [Más detalles sobre la gestión del estado.](#más-detalles-sobre-la-gestión-del-estado) 28 - [Más detalles sobre la gestión del estado.](#más-detalles-sobre-la-gestión-del-estado)
29 - - [Explicación en video sobre state management](#video-explanation-about-state-management) 29 + - [Explicación en video sobre state management](#explicación-en-video-sobre-state-management)
30 - [Gestión de Rutas](#gestión-de-rutas) 30 - [Gestión de Rutas](#gestión-de-rutas)
31 - [Más detalles sobre la gestión de rutas.](#más-detalles-sobre-la-gestión-de-rutas) 31 - [Más detalles sobre la gestión de rutas.](#más-detalles-sobre-la-gestión-de-rutas)
32 - - [Explicación del video](#video-explanation) 32 + - [Explicación del video](#explicación-del-video)
33 - [Gestión de dependencias](#gestión-de-dependencias) 33 - [Gestión de dependencias](#gestión-de-dependencias)
34 - [Más detalles sobre la gestión de dependencias.](#más-detalles-sobre-la-gestión-de-dependencias) 34 - [Más detalles sobre la gestión de dependencias.](#más-detalles-sobre-la-gestión-de-dependencias)
35 -- [Utilidades](#utils) 35 +- [Utilidades](#utilidades)
36 - [Cambiar de tema](#cambiar-de-tema) 36 - [Cambiar de tema](#cambiar-de-tema)
37 - [Otras API avanzadas y configuraciones manuales](#otras-api-avanzadas-y-configuraciones-manuales) 37 - [Otras API avanzadas y configuraciones manuales](#otras-api-avanzadas-y-configuraciones-manuales)
38 - [Configuraciones globales opcionales](#configuraciones-globales-opcionales) 38 - [Configuraciones globales opcionales](#configuraciones-globales-opcionales)
39 - - [Explicación en video de Other GetX Features](#video-explanation-of-other-getx-features) 39 + - [Video explanation of Other GetX Features](#video-explanation-of-other-getx-features)
40 - [Rompiendo cambios desde 2.0](#rompiendo-cambios-desde-20) 40 - [Rompiendo cambios desde 2.0](#rompiendo-cambios-desde-20)
41 - [¿Por qué Getx?](#por-qué-getx) 41 - [¿Por qué Getx?](#por-qué-getx)
42 42
@@ -155,7 +155,7 @@ class Other extends StatelessWidget { @@ -155,7 +155,7 @@ class Other extends StatelessWidget {
155 155
156 Resultado: 156 Resultado:
157 157
158 -![](counter-app-gif.gif) 158 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/counter-app-gif.gif)
159 159
160 Este es un proyecto simple pero ya deja en claro cuán poderoso es GetX. A medida que su proyecto crezca, esta diferencia se volverá más significativa. GetX fue diseñado para trabajar con equipos, pero también simplifica el trabajo de un desarrollador individual. Mejore sus plazos, entregue todo a tiempo, sin perder rendimiento. GetX no es para todos, pero si te identificaste con esa frase, ¡GET es para ti! 160 Este es un proyecto simple pero ya deja en claro cuán poderoso es GetX. A medida que su proyecto crezca, esta diferencia se volverá más significativa. GetX fue diseñado para trabajar con equipos, pero también simplifica el trabajo de un desarrollador individual. Mejore sus plazos, entregue todo a tiempo, sin perder rendimiento. GetX no es para todos, pero si te identificaste con esa frase, ¡GET es para ti!
161 161
1 -![](get.png) 1 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/get.png)
2 2
3 _Languages: English (this file), [Chinese](README.zh-cn.md), [Brazilian Portuguese](README.pt-br.md), [Spanish](README-es.md),[Polish](README.pl.md)._ 3 _Languages: English (this file), [Chinese](README.zh-cn.md), [Brazilian Portuguese](README.pt-br.md), [Spanish](README-es.md),[Polish](README.pl.md)._
4 4
@@ -13,7 +13,7 @@ _Languages: English (this file), [Chinese](README.zh-cn.md), [Brazilian Portugue @@ -13,7 +13,7 @@ _Languages: English (this file), [Chinese](README.zh-cn.md), [Brazilian Portugue
13 </a> 13 </a>
14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a> 14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a>
15 15
16 -![](getx.png) 16 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/getx.png)
17 17
18 - [About Get](#about-get) 18 - [About Get](#about-get)
19 - [Installing](#installing) 19 - [Installing](#installing)
@@ -148,7 +148,7 @@ class Other extends StatelessWidget { @@ -148,7 +148,7 @@ class Other extends StatelessWidget {
148 148
149 Result: 149 Result:
150 150
151 -![](counter-app-gif.gif) 151 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/counter-app-gif.gif)
152 152
153 This is a simple project but it already makes clear how powerful Get is. As your project grows, this difference will become more significant. 153 This is a simple project but it already makes clear how powerful Get is. As your project grows, this difference will become more significant.
154 154
1 -![](get.png) 1 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/get.png)
2 2
3 *Languages: [English](README.md), [Język chiński](README.zh-cn.md), [Brazilian Portuguese](README.pt-br.md), [Spanish](README-es.md), Polish (Jesteś tu).* 3 *Languages: [English](README.md), [Język chiński](README.zh-cn.md), [Brazilian Portuguese](README.pt-br.md), [Spanish](README-es.md), Polish (Jesteś tu).*
4 4
@@ -14,28 +14,28 @@ @@ -14,28 +14,28 @@
14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a> 14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a>
15 15
16 16
17 -![](getx.png) 17 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/getx.png)
18 18
19 - [Kanały komunikacji i wsparcia:](#kanały-komunikacji-i-wsparcia) 19 - [Kanały komunikacji i wsparcia:](#kanały-komunikacji-i-wsparcia)
20 - [Wprowadzenie](#wprowadzenie) 20 - [Wprowadzenie](#wprowadzenie)
21 - [Instalacja](#instalacja) 21 - [Instalacja](#instalacja)
22 - [Counter App z GetX](#counter-app-z-getx) 22 - [Counter App z GetX](#counter-app-z-getx)
23 -- [Trzy fialary](#trzy-filary) 23 +- [Trzy filary](#trzy-filary)
24 - [Menadżer stanu](#menadżer-stanu) 24 - [Menadżer stanu](#menadżer-stanu)
25 - [Reaktywny menadżer stanu](#reaktywny-menadżer-stanu) 25 - [Reaktywny menadżer stanu](#reaktywny-menadżer-stanu)
26 - [Bardziej szczegółowo o menadżerze stanu](#bardziej-szczegółowo-o-menadżerze-stanu) 26 - [Bardziej szczegółowo o menadżerze stanu](#bardziej-szczegółowo-o-menadżerze-stanu)
27 - [Video tłumaczące użycie menadżera stanu](#video-tłumaczące-użycie-menadżera-stanu) 27 - [Video tłumaczące użycie menadżera stanu](#video-tłumaczące-użycie-menadżera-stanu)
28 - - [Zarzadzanie routami](#zarządzanie-routami) 28 + - [Zarządzanie routami](#zarządzanie-routami)
29 - [Więcej o routach](#więcej-o-routach) 29 - [Więcej o routach](#więcej-o-routach)
30 - [Video tłumaczące użycie](#video-tłumaczące-użycie) 30 - [Video tłumaczące użycie](#video-tłumaczące-użycie)
31 - [Zarządzanie dependencies](#zarządzanie-dependencies) 31 - [Zarządzanie dependencies](#zarządzanie-dependencies)
32 - - [Bardziej szczefółowo o menadżerze dependencies](#bardziej-szczegółowo-o-menadżerze-dependencies) 32 + - [Bardziej szczegółowo o menadżerze dependencies](#bardziej-szczegółowo-o-menadżerze-dependencies)
33 - [Jak włożyć coś od siebie](#jak-włożyć-coś-od-siebie) 33 - [Jak włożyć coś od siebie](#jak-włożyć-coś-od-siebie)
34 - [Narzędzia](#narzędzia) 34 - [Narzędzia](#narzędzia)
35 - [Zmiana motywu](#zmiana-motywu) 35 - [Zmiana motywu](#zmiana-motywu)
36 - - [Inne zaawansowane API](#inne-zaawansowane-api) 36 + - [Inne zaawansowane API](#inne-zaawansowane-api)
37 - [Opcjonalne globalne ustawienia i manualna konfiguracja](#opcjonalne-globalne-ustawienia-i-manualna-konfiguracja) 37 - [Opcjonalne globalne ustawienia i manualna konfiguracja](#opcjonalne-globalne-ustawienia-i-manualna-konfiguracja)
38 - - [Video tłumaczace inne funkcjonalności GetX](#video-tłumaczące-inne-funkcjonalności-getx) 38 + - [Video tłumaczące inne funkcjonalności GetX](#video-tłumaczące-inne-funkcjonalności-getx)
39 - [Zmiany od 2.0](#zmiany-od-20) 39 - [Zmiany od 2.0](#zmiany-od-20)
40 40
41 41
@@ -130,7 +130,7 @@ class Other extends StatelessWidget { @@ -130,7 +130,7 @@ class Other extends StatelessWidget {
130 ``` 130 ```
131 Wynik: 131 Wynik:
132 132
133 -![](counter-app-gif.gif) 133 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/counter-app-gif.gif)
134 134
135 Jest to prosty projekt, ale już na jego przykładzie widać potęgę Get. Wzraz ze wzrostem rozmiaru aplikacji ta różnica tylko się powieksza. 135 Jest to prosty projekt, ale już na jego przykładzie widać potęgę Get. Wzraz ze wzrostem rozmiaru aplikacji ta różnica tylko się powieksza.
136 136
1 -![](get.png) 1 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/get.png)
2 2
3 *Idiomas: [Inglês](README.md), [Língua chinesa](README.zh-cn.md), Português Brasileiro (este arquivo), [Espanhol](README-es.md), [Polaco](README.pl.md).* 3 *Idiomas: [Inglês](README.md), [Língua chinesa](README.zh-cn.md), Português Brasileiro (este arquivo), [Espanhol](README-es.md), [Polaco](README.pl.md).*
4 4
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a> 14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a>
15 15
16 16
17 -![](getx.png) 17 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/getx.png)
18 18
19 <h2> Pedimos desculpas por qualquer parte não traduzida aqui. O GetX™ é atualizado com muita frequência e as traduções podem não vir ao mesmo tempo. Então, para manter essa documentação pelo menos com tudo que a versão em inglês tem, eu vou deixar todos os textos não-traduzidos aqui (eu considero que é melhor ele estar lá em inglês do que não estar), então se alguém quiser traduzir, seria muito útil 😁</h2> 19 <h2> Pedimos desculpas por qualquer parte não traduzida aqui. O GetX™ é atualizado com muita frequência e as traduções podem não vir ao mesmo tempo. Então, para manter essa documentação pelo menos com tudo que a versão em inglês tem, eu vou deixar todos os textos não-traduzidos aqui (eu considero que é melhor ele estar lá em inglês do que não estar), então se alguém quiser traduzir, seria muito útil 😁</h2>
20 20
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 - [Traduções](#traduções) 36 - [Traduções](#traduções)
37 - [Usando traduções](#usando-traduções) 37 - [Usando traduções](#usando-traduções)
38 - [Localidade](#localidade) 38 - [Localidade](#localidade)
39 - - [Alterar Local](#alterar-local) 39 + - [Alterar local](#alterar-local)
40 - [Localidade do sistema operacional](#localidade-do-sistema-operacional) 40 - [Localidade do sistema operacional](#localidade-do-sistema-operacional)
41 - [Mudar tema (changeTheme)](#mudar-tema-changetheme) 41 - [Mudar tema (changeTheme)](#mudar-tema-changetheme)
42 - [Outras APIs avançadas](#outras-apis-avançadas) 42 - [Outras APIs avançadas](#outras-apis-avançadas)
@@ -44,17 +44,17 @@ @@ -44,17 +44,17 @@
44 - [Widgets de Estado Local](#widgets-de-estado-local) 44 - [Widgets de Estado Local](#widgets-de-estado-local)
45 - [ValueBuilder](#valuebuilder) 45 - [ValueBuilder](#valuebuilder)
46 - [ObxValue](#obxvalue) 46 - [ObxValue](#obxvalue)
  47 + - [Explicação em vídeo sobre Outras Features do GetX](#explicação-em-vídeo-sobre-outras-features-do-getx)
47 - [Dicas Úteis](#dicas-úteis) 48 - [Dicas Úteis](#dicas-úteis)
48 - [GetView](#getview) 49 - [GetView](#getview)
49 - [GetWidget](#getwidget) 50 - [GetWidget](#getwidget)
50 - [GetxService](#getxservice) 51 - [GetxService](#getxservice)
51 - - [Explicação em vídeo sobre Outras Features do GetX](#explicação-em-vídeo-sobre-outras-features-do-getx)  
52 - [Breaking Changes da versão 2 para 3](#breaking-changes-da-versão-2-para-3) 52 - [Breaking Changes da versão 2 para 3](#breaking-changes-da-versão-2-para-3)
53 - [Tipagem Rx](#tipagem-rx) 53 - [Tipagem Rx](#tipagem-rx)
54 - [RxController e GetBuilder se uniram](#rxcontroller-e-getbuilder-se-uniram) 54 - [RxController e GetBuilder se uniram](#rxcontroller-e-getbuilder-se-uniram)
55 - [Rotas nomeadas](#rotas-nomeadas) 55 - [Rotas nomeadas](#rotas-nomeadas)
56 - - [Porque essa mudança](#porque-essa-mudança)  
57 -- [Por que GetX?](#por-que-getx) 56 + - [Porque essa mudança?](#porque-essa-mudança)
  57 +- [Por que GetX™?](#por-que-getx)
58 - [Comunidade](#comunidade) 58 - [Comunidade](#comunidade)
59 - [Canais da comunidade](#canais-da-comunidade) 59 - [Canais da comunidade](#canais-da-comunidade)
60 - [Como contribuir](#como-contribuir) 60 - [Como contribuir](#como-contribuir)
@@ -147,7 +147,7 @@ class Outra extends StatelessWidget { @@ -147,7 +147,7 @@ class Outra extends StatelessWidget {
147 147
148 Resultado: 148 Resultado:
149 149
150 -![](counter-app-gif.gif) 150 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/counter-app-gif.gif)
151 151
152 Esse é um projeto simples mas já deixa claro o quão poderoso o Get é. Enquanto seu projeto cresce, essa diferença se torna bem mais significante. 152 Esse é um projeto simples mas já deixa claro o quão poderoso o Get é. Enquanto seu projeto cresce, essa diferença se torna bem mais significante.
153 153
@@ -824,14 +824,14 @@ o ciclo de vida de seu aplicativo, use GetxService. @@ -824,14 +824,14 @@ o ciclo de vida de seu aplicativo, use GetxService.
824 824
825 ## Tipagem Rx 825 ## Tipagem Rx
826 826
827 -| Antes | Depois |  
828 -| -------- | ---------- |  
829 -| StringX | `RxString` |  
830 -| IntX | `RxInt` |  
831 -| MapX | `RxMap` |  
832 -| ListX | `RxList` |  
833 -| NumX | `RxNum` |  
834 -| DoubleX | `RxDouble` | 827 +| Antes | Depois |
  828 +| ------- | ---------- |
  829 +| StringX | `RxString` |
  830 +| IntX | `RxInt` |
  831 +| MapX | `RxMap` |
  832 +| ListX | `RxList` |
  833 +| NumX | `RxNum` |
  834 +| DoubleX | `RxDouble` |
835 835
836 ## RxController e GetBuilder se uniram 836 ## RxController e GetBuilder se uniram
837 837
1 -![](get.png) 1 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/get.png)
2 2
3 _语言: 中文, [英文](README.md), [巴西葡萄牙语](README.pt-br.md), [西班牙语](README-es.md), [波兰语](README.pl.md)_ 3 _语言: 中文, [英文](README.md), [巴西葡萄牙语](README.pt-br.md), [西班牙语](README-es.md), [波兰语](README.pl.md)_
4 4
@@ -13,11 +13,11 @@ _语言: 中文, [英文](README.md), [巴西葡萄牙语](README.pt-br.md), [ @@ -13,11 +13,11 @@ _语言: 中文, [英文](README.md), [巴西葡萄牙语](README.pt-br.md), [
13 </a> 13 </a>
14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a> 14 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://i.imgur.com/aV6DDA7.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a>
15 15
16 -![](getx.png) 16 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/getx.png)
17 17
18 -- [关于 Get](#关于Get) 18 +- [关于Get](#关于get)
19 - [安装](#安装) 19 - [安装](#安装)
20 -- [GetX 的计数器示例](#GetX的计数器示例) 20 +- [GetX的计数器示例](#getx的计数器示例)
21 - [三大功能](#三大功能) 21 - [三大功能](#三大功能)
22 - [状态管理](#状态管理) 22 - [状态管理](#状态管理)
23 - [响应式状态管理器](#响应式状态管理器) 23 - [响应式状态管理器](#响应式状态管理器)
@@ -34,7 +34,7 @@ _语言: 中文, [英文](README.md), [巴西葡萄牙语](README.pt-br.md), [ @@ -34,7 +34,7 @@ _语言: 中文, [英文](README.md), [巴西葡萄牙语](README.pt-br.md), [
34 - [改变语言](#改变语言) 34 - [改变语言](#改变语言)
35 - [系统语言](#系统语言) 35 - [系统语言](#系统语言)
36 - [改变主题](#改变主题) 36 - [改变主题](#改变主题)
37 - - [其他高级API](#其他高级API) 37 + - [其他高级API](#其他高级api)
38 - [可选的全局设置和手动配置](#可选的全局设置和手动配置) 38 - [可选的全局设置和手动配置](#可选的全局设置和手动配置)
39 - [局部状态组件](#局部状态组件) 39 - [局部状态组件](#局部状态组件)
40 - [ValueBuilder](#valuebuilder) 40 - [ValueBuilder](#valuebuilder)
@@ -43,10 +43,10 @@ _语言: 中文, [英文](README.md), [巴西葡萄牙语](README.pt-br.md), [ @@ -43,10 +43,10 @@ _语言: 中文, [英文](README.md), [巴西葡萄牙语](README.pt-br.md), [
43 - [GetView](#getview) 43 - [GetView](#getview)
44 - [GetWidget](#getwidget) 44 - [GetWidget](#getwidget)
45 - [GetxService](#getxservice) 45 - [GetxService](#getxservice)
46 -- [从2.0开始的兼容性变化](#从2.0开始的兼容性变化)  
47 -- [为什么选择Getx?](#为什么选择Getx?) 46 +- [从2.0开始的兼容性变化](#从20开始的兼容性变化)
  47 +- [为什么选择Getx?](#为什么选择getx)
48 - [社区](#社区) 48 - [社区](#社区)
49 - - [社区频道](#社区频) 49 + - [社区渠道](#社区渠)
50 - [如何做贡献](#如何做贡献) 50 - [如何做贡献](#如何做贡献)
51 - [文章和视频](#文章和视频) 51 - [文章和视频](#文章和视频)
52 52
@@ -151,7 +151,7 @@ class Other extends StatelessWidget { @@ -151,7 +151,7 @@ class Other extends StatelessWidget {
151 151
152 结果: 152 结果:
153 153
154 -![](counter-app-gif.gif) 154 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/counter-app-gif.gif)
155 155
156 这是一个简单的项目,但它已经让人明白Get的强大。随着项目的发展,这种差异将变得更加显著。 156 这是一个简单的项目,但它已经让人明白Get的强大。随着项目的发展,这种差异将变得更加显著。
157 157
1 -gradle-wrapper.jar  
2 -/.gradle  
3 -/captures/  
4 -/gradlew  
5 -/gradlew.bat  
6 -/local.properties  
7 -GeneratedPluginRegistrant.java  
8 -  
9 -# Remember to never publicly share your keystore.  
10 -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app  
11 -key.properties  
1 -def localProperties = new Properties()  
2 -def localPropertiesFile = rootProject.file('local.properties')  
3 -if (localPropertiesFile.exists()) {  
4 - localPropertiesFile.withReader('UTF-8') { reader ->  
5 - localProperties.load(reader)  
6 - }  
7 -}  
8 -  
9 -def flutterRoot = localProperties.getProperty('flutter.sdk')  
10 -if (flutterRoot == null) {  
11 - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")  
12 -}  
13 -  
14 -def flutterVersionCode = localProperties.getProperty('flutter.versionCode')  
15 -if (flutterVersionCode == null) {  
16 - flutterVersionCode = '1'  
17 -}  
18 -  
19 -def flutterVersionName = localProperties.getProperty('flutter.versionName')  
20 -if (flutterVersionName == null) {  
21 - flutterVersionName = '1.0'  
22 -}  
23 -  
24 -apply plugin: 'com.android.application'  
25 -apply plugin: 'kotlin-android'  
26 -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"  
27 -  
28 -android {  
29 - compileSdkVersion 29  
30 -  
31 - sourceSets {  
32 - main.java.srcDirs += 'src/main/kotlin'  
33 - }  
34 -  
35 - lintOptions {  
36 - disable 'InvalidPackage'  
37 - }  
38 -  
39 - defaultConfig {  
40 - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).  
41 - applicationId "getx.demo.app.example"  
42 - minSdkVersion 16  
43 - targetSdkVersion 29  
44 - versionCode flutterVersionCode.toInteger()  
45 - versionName flutterVersionName  
46 - }  
47 -  
48 - buildTypes {  
49 - release {  
50 - // TODO: Add your own signing config for the release build.  
51 - // Signing with the debug keys for now, so `flutter run --release` works.  
52 - signingConfig signingConfigs.debug  
53 - }  
54 - }  
55 -}  
56 -  
57 -flutter {  
58 - source '../..'  
59 -}  
60 -  
61 -dependencies {  
62 - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"  
63 -}  
1 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
2 - package="getx.demo.app.example">  
3 - <!-- Flutter needs it to communicate with the running application  
4 - to allow setting breakpoints, to provide hot reload, etc.  
5 - -->  
6 - <uses-permission android:name="android.permission.INTERNET"/>  
7 -</manifest>  
1 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
2 - package="getx.demo.app.example">  
3 - <!-- io.flutter.app.FlutterApplication is an android.app.Application that  
4 - calls FlutterMain.startInitialization(this); in its onCreate method.  
5 - In most cases you can leave this as-is, but you if you want to provide  
6 - additional functionality it is fine to subclass or reimplement  
7 - FlutterApplication and put your custom class here. -->  
8 - <application  
9 - android:name="io.flutter.app.FlutterApplication"  
10 - android:label="example"  
11 - android:icon="@mipmap/ic_launcher">  
12 - <activity  
13 - android:name=".MainActivity"  
14 - android:launchMode="singleTop"  
15 - android:theme="@style/LaunchTheme"  
16 - android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"  
17 - android:hardwareAccelerated="true"  
18 - android:windowSoftInputMode="adjustResize">  
19 - <!-- Specifies an Android theme to apply to this Activity as soon as  
20 - the Android process has started. This theme is visible to the user  
21 - while the Flutter UI initializes. After that, this theme continues  
22 - to determine the Window background behind the Flutter UI. -->  
23 - <meta-data  
24 - android:name="io.flutter.embedding.android.NormalTheme"  
25 - android:resource="@style/NormalTheme"  
26 - />  
27 - <!-- Displays an Android View that continues showing the launch screen  
28 - Drawable until Flutter paints its first frame, then this splash  
29 - screen fades out. A splash screen is useful to avoid any visual  
30 - gap between the end of Android's launch screen and the painting of  
31 - Flutter's first frame. -->  
32 - <meta-data  
33 - android:name="io.flutter.embedding.android.SplashScreenDrawable"  
34 - android:resource="@drawable/launch_background"  
35 - />  
36 - <intent-filter>  
37 - <action android:name="android.intent.action.MAIN"/>  
38 - <category android:name="android.intent.category.LAUNCHER"/>  
39 - </intent-filter>  
40 - </activity>  
41 - <!-- Don't delete the meta-data below.  
42 - This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->  
43 - <meta-data  
44 - android:name="flutterEmbedding"  
45 - android:value="2" />  
46 - </application>  
47 -</manifest>  
1 -package getx.demo.app.example  
2 -  
3 -import io.flutter.embedding.android.FlutterActivity  
4 -  
5 -class MainActivity: FlutterActivity() {  
6 -}  
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<!-- Modify this file to customize your launch splash screen -->  
3 -<layer-list xmlns:android="http://schemas.android.com/apk/res/android">  
4 - <item android:drawable="@android:color/white" />  
5 -  
6 - <!-- You can insert your own image assets here -->  
7 - <!-- <item>  
8 - <bitmap  
9 - android:gravity="center"  
10 - android:src="@mipmap/launch_image" />  
11 - </item> -->  
12 -</layer-list>  
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<resources>  
3 - <!-- Theme applied to the Android Window while the process is starting -->  
4 - <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">  
5 - <!-- Show a splash screen on the activity. Automatically removed when  
6 - Flutter draws its first frame -->  
7 - <item name="android:windowBackground">@drawable/launch_background</item>  
8 - </style>  
9 - <!-- Theme applied to the Android Window as soon as the process has started.  
10 - This theme determines the color of the Android Window while your  
11 - Flutter UI initializes, as well as behind your Flutter UI while its  
12 - running.  
13 -  
14 - This Theme is only used starting with V2 of Flutter's Android embedding. -->  
15 - <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">  
16 - <item name="android:windowBackground">@android:color/white</item>  
17 - </style>  
18 -</resources>  
1 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
2 - package="getx.demo.app.example">  
3 - <!-- Flutter needs it to communicate with the running application  
4 - to allow setting breakpoints, to provide hot reload, etc.  
5 - -->  
6 - <uses-permission android:name="android.permission.INTERNET"/>  
7 -</manifest>  
1 -buildscript {  
2 - ext.kotlin_version = '1.3.50'  
3 - repositories {  
4 - google()  
5 - jcenter()  
6 - }  
7 -  
8 - dependencies {  
9 - classpath 'com.android.tools.build:gradle:3.5.0'  
10 - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"  
11 - }  
12 -}  
13 -  
14 -allprojects {  
15 - repositories {  
16 - google()  
17 - jcenter()  
18 - }  
19 -}  
20 -  
21 -rootProject.buildDir = '../build'  
22 -subprojects {  
23 - project.buildDir = "${rootProject.buildDir}/${project.name}"  
24 -}  
25 -subprojects {  
26 - project.evaluationDependsOn(':app')  
27 -}  
28 -  
29 -task clean(type: Delete) {  
30 - delete rootProject.buildDir  
31 -}  
1 -org.gradle.jvmargs=-Xmx1536M  
2 -android.useAndroidX=true  
3 -android.enableJetifier=true  
4 -android.enableR8=true  
1 -#Fri Jun 23 08:50:38 CEST 2017  
2 -distributionBase=GRADLE_USER_HOME  
3 -distributionPath=wrapper/dists  
4 -zipStoreBase=GRADLE_USER_HOME  
5 -zipStorePath=wrapper/dists  
6 -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip  
1 -include ':app'  
2 -  
3 -def localPropertiesFile = new File(rootProject.projectDir, "local.properties")  
4 -def properties = new Properties()  
5 -  
6 -assert localPropertiesFile.exists()  
7 -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }  
8 -  
9 -def flutterSdkPath = properties.getProperty("flutter.sdk")  
10 -assert flutterSdkPath != null, "flutter.sdk not set in local.properties"  
11 -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"  
1 -flutter/ephemeral  
1 -cmake_minimum_required(VERSION 3.10)  
2 -project(runner LANGUAGES CXX)  
3 -  
4 -set(BINARY_NAME "example")  
5 -set(APPLICATION_ID "getx.demo.app.example")  
6 -  
7 -cmake_policy(SET CMP0063 NEW)  
8 -  
9 -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")  
10 -  
11 -# Configure build options.  
12 -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)  
13 - set(CMAKE_BUILD_TYPE "Debug" CACHE  
14 - STRING "Flutter build mode" FORCE)  
15 - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS  
16 - "Debug" "Profile" "Release")  
17 -endif()  
18 -  
19 -# Compilation settings that should be applied to most targets.  
20 -function(APPLY_STANDARD_SETTINGS TARGET)  
21 - target_compile_features(${TARGET} PUBLIC cxx_std_14)  
22 - target_compile_options(${TARGET} PRIVATE -Wall -Werror)  
23 - target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")  
24 - target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")  
25 -endfunction()  
26 -  
27 -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")  
28 -  
29 -# Flutter library and tool build rules.  
30 -add_subdirectory(${FLUTTER_MANAGED_DIR})  
31 -  
32 -# System-level dependencies.  
33 -find_package(PkgConfig REQUIRED)  
34 -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)  
35 -  
36 -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")  
37 -  
38 -# Application build  
39 -add_executable(${BINARY_NAME}  
40 - "main.cc"  
41 - "my_application.cc"  
42 - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"  
43 -)  
44 -apply_standard_settings(${BINARY_NAME})  
45 -target_link_libraries(${BINARY_NAME} PRIVATE flutter)  
46 -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)  
47 -add_dependencies(${BINARY_NAME} flutter_assemble)  
48 -# Only the install-generated bundle's copy of the executable will launch  
49 -# correctly, since the resources must in the right relative locations. To avoid  
50 -# people trying to run the unbundled copy, put it in a subdirectory instead of  
51 -# the default top-level location.  
52 -set_target_properties(${BINARY_NAME}  
53 - PROPERTIES  
54 - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"  
55 -)  
56 -  
57 -# Generated plugin build rules, which manage building the plugins and adding  
58 -# them to the application.  
59 -include(flutter/generated_plugins.cmake)  
60 -  
61 -  
62 -# === Installation ===  
63 -# By default, "installing" just makes a relocatable bundle in the build  
64 -# directory.  
65 -set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")  
66 -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)  
67 - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)  
68 -endif()  
69 -  
70 -# Start with a clean build bundle directory every time.  
71 -install(CODE "  
72 - file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")  
73 - " COMPONENT Runtime)  
74 -  
75 -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")  
76 -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")  
77 -  
78 -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"  
79 - COMPONENT Runtime)  
80 -  
81 -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"  
82 - COMPONENT Runtime)  
83 -  
84 -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"  
85 - COMPONENT Runtime)  
86 -  
87 -if(PLUGIN_BUNDLED_LIBRARIES)  
88 - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"  
89 - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"  
90 - COMPONENT Runtime)  
91 -endif()  
92 -  
93 -# Fully re-copy the assets directory on each build to avoid having stale files  
94 -# from a previous install.  
95 -set(FLUTTER_ASSET_DIR_NAME "flutter_assets")  
96 -install(CODE "  
97 - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")  
98 - " COMPONENT Runtime)  
99 -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"  
100 - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)  
101 -  
102 -# Install the AOT library on non-Debug builds only.  
103 -if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")  
104 - install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"  
105 - COMPONENT Runtime)  
106 -endif()  
1 -cmake_minimum_required(VERSION 3.10)  
2 -  
3 -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")  
4 -  
5 -# Configuration provided via flutter tool.  
6 -include(${EPHEMERAL_DIR}/generated_config.cmake)  
7 -  
8 -# TODO: Move the rest of this into files in ephemeral. See  
9 -# https://github.com/flutter/flutter/issues/57146.  
10 -  
11 -# Serves the same purpose as list(TRANSFORM ... PREPEND ...),  
12 -# which isn't available in 3.10.  
13 -function(list_prepend LIST_NAME PREFIX)  
14 - set(NEW_LIST "")  
15 - foreach(element ${${LIST_NAME}})  
16 - list(APPEND NEW_LIST "${PREFIX}${element}")  
17 - endforeach(element)  
18 - set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)  
19 -endfunction()  
20 -  
21 -# === Flutter Library ===  
22 -# System-level dependencies.  
23 -find_package(PkgConfig REQUIRED)  
24 -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)  
25 -pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)  
26 -pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)  
27 -pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid)  
28 -  
29 -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")  
30 -  
31 -# Published to parent scope for install step.  
32 -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)  
33 -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)  
34 -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)  
35 -set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)  
36 -  
37 -list(APPEND FLUTTER_LIBRARY_HEADERS  
38 - "fl_basic_message_channel.h"  
39 - "fl_binary_codec.h"  
40 - "fl_binary_messenger.h"  
41 - "fl_dart_project.h"  
42 - "fl_engine.h"  
43 - "fl_json_message_codec.h"  
44 - "fl_json_method_codec.h"  
45 - "fl_message_codec.h"  
46 - "fl_method_call.h"  
47 - "fl_method_channel.h"  
48 - "fl_method_codec.h"  
49 - "fl_method_response.h"  
50 - "fl_plugin_registrar.h"  
51 - "fl_plugin_registry.h"  
52 - "fl_standard_message_codec.h"  
53 - "fl_standard_method_codec.h"  
54 - "fl_string_codec.h"  
55 - "fl_value.h"  
56 - "fl_view.h"  
57 - "flutter_linux.h"  
58 -)  
59 -list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")  
60 -add_library(flutter INTERFACE)  
61 -target_include_directories(flutter INTERFACE  
62 - "${EPHEMERAL_DIR}"  
63 -)  
64 -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")  
65 -target_link_libraries(flutter INTERFACE  
66 - PkgConfig::GTK  
67 - PkgConfig::GLIB  
68 - PkgConfig::GIO  
69 - PkgConfig::BLKID  
70 -)  
71 -add_dependencies(flutter flutter_assemble)  
72 -  
73 -# === Flutter tool backend ===  
74 -# _phony_ is a non-existent file to force this command to run every time,  
75 -# since currently there's no way to get a full input/output list from the  
76 -# flutter tool.  
77 -add_custom_command(  
78 - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}  
79 - ${CMAKE_CURRENT_BINARY_DIR}/_phony_  
80 - COMMAND ${CMAKE_COMMAND} -E env  
81 - ${FLUTTER_TOOL_ENVIRONMENT}  
82 - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"  
83 - linux-x64 ${CMAKE_BUILD_TYPE}  
84 -)  
85 -add_custom_target(flutter_assemble DEPENDS  
86 - "${FLUTTER_LIBRARY}"  
87 - ${FLUTTER_LIBRARY_HEADERS}  
88 -)  
1 -//  
2 -// Generated file. Do not edit.  
3 -//  
4 -  
5 -#include "generated_plugin_registrant.h"  
6 -  
7 -  
8 -void fl_register_plugins(FlPluginRegistry* registry) {  
9 -}  
1 -//  
2 -// Generated file. Do not edit.  
3 -//  
4 -  
5 -#ifndef GENERATED_PLUGIN_REGISTRANT_  
6 -#define GENERATED_PLUGIN_REGISTRANT_  
7 -  
8 -#include <flutter_linux/flutter_linux.h>  
9 -  
10 -// Registers Flutter plugins.  
11 -void fl_register_plugins(FlPluginRegistry* registry);  
12 -  
13 -#endif // GENERATED_PLUGIN_REGISTRANT_  
1 -#  
2 -# Generated file, do not edit.  
3 -#  
4 -  
5 -list(APPEND FLUTTER_PLUGIN_LIST  
6 -)  
7 -  
8 -set(PLUGIN_BUNDLED_LIBRARIES)  
9 -  
10 -foreach(plugin ${FLUTTER_PLUGIN_LIST})  
11 - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})  
12 - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)  
13 - list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)  
14 - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})  
15 -endforeach(plugin)  
1 -#include "my_application.h"  
2 -  
3 -int main(int argc, char** argv) {  
4 - // Only X11 is currently supported.  
5 - // Wayland support is being developed: https://github.com/flutter/flutter/issues/57932.  
6 - gdk_set_allowed_backends("x11");  
7 -  
8 - g_autoptr(MyApplication) app = my_application_new();  
9 - return g_application_run(G_APPLICATION(app), argc, argv);  
10 -}  
1 -#include "my_application.h"  
2 -  
3 -#include <flutter_linux/flutter_linux.h>  
4 -  
5 -#include "flutter/generated_plugin_registrant.h"  
6 -  
7 -struct _MyApplication {  
8 - GtkApplication parent_instance;  
9 -};  
10 -  
11 -G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)  
12 -  
13 -// Implements GApplication::activate.  
14 -static void my_application_activate(GApplication* application) {  
15 - GtkWindow* window =  
16 - GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));  
17 - GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());  
18 - gtk_widget_show(GTK_WIDGET(header_bar));  
19 - gtk_header_bar_set_title(header_bar, "example");  
20 - gtk_header_bar_set_show_close_button(header_bar, TRUE);  
21 - gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));  
22 - gtk_window_set_default_size(window, 1280, 720);  
23 - gtk_widget_show(GTK_WIDGET(window));  
24 -  
25 - g_autoptr(FlDartProject) project = fl_dart_project_new();  
26 -  
27 - FlView* view = fl_view_new(project);  
28 - gtk_widget_show(GTK_WIDGET(view));  
29 - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));  
30 -  
31 - fl_register_plugins(FL_PLUGIN_REGISTRY(view));  
32 -  
33 - gtk_widget_grab_focus(GTK_WIDGET(view));  
34 -}  
35 -  
36 -static void my_application_class_init(MyApplicationClass* klass) {  
37 - G_APPLICATION_CLASS(klass)->activate = my_application_activate;  
38 -}  
39 -  
40 -static void my_application_init(MyApplication* self) {}  
41 -  
42 -MyApplication* my_application_new() {  
43 - return MY_APPLICATION(g_object_new(my_application_get_type(),  
44 - "application-id", APPLICATION_ID,  
45 - nullptr));  
46 -}  
1 -#ifndef FLUTTER_MY_APPLICATION_H_  
2 -#define FLUTTER_MY_APPLICATION_H_  
3 -  
4 -#include <gtk/gtk.h>  
5 -  
6 -G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,  
7 - GtkApplication)  
8 -  
9 -/**  
10 - * my_application_new:  
11 - *  
12 - * Creates a new Flutter-based application.  
13 - *  
14 - * Returns: a new #MyApplication.  
15 - */  
16 -MyApplication* my_application_new();  
17 -  
18 -#endif // FLUTTER_MY_APPLICATION_H_  
@@ -27,16 +27,14 @@ dependencies: @@ -27,16 +27,14 @@ dependencies:
27 # The following adds the Cupertino Icons font to your application. 27 # The following adds the Cupertino Icons font to your application.
28 # Use with the CupertinoIcons class for iOS style icons. 28 # Use with the CupertinoIcons class for iOS style icons.
29 get: 29 get:
30 - git:  
31 - url: git://github.com/jonataslaw/getx.git  
32 - path: getx  
33 - ref: master 30 + path: ../
34 dio: ^3.0.9 31 dio: ^3.0.9
35 - get_test:  
36 - git:  
37 - url: git://github.com/jonataslaw/getx.git  
38 - path: packages/get_test  
39 - ref: master 32 + get_test: ^3.13.2
  33 +
  34 +dependency_overrides:
  35 + get:
  36 + path: ../
  37 +
40 dev_dependencies: 38 dev_dependencies:
41 flutter_test: 39 flutter_test:
42 sdk: flutter 40 sdk: flutter
1 -<!DOCTYPE html>  
2 -<html>  
3 -<head>  
4 - <meta charset="UTF-8">  
5 - <meta content="IE=Edge" http-equiv="X-UA-Compatible">  
6 - <meta name="description" content="A new Flutter project.">  
7 -  
8 - <!-- iOS meta tags & icons -->  
9 - <meta name="apple-mobile-web-app-capable" content="yes">  
10 - <meta name="apple-mobile-web-app-status-bar-style" content="black">  
11 - <meta name="apple-mobile-web-app-title" content="example">  
12 - <link rel="apple-touch-icon" href="icons/Icon-192.png">  
13 -  
14 - <!-- Favicon -->  
15 - <link rel="icon" type="image/png" href="favicon.png"/>  
16 -  
17 - <title>example</title>  
18 - <link rel="manifest" href="manifest.json">  
19 -</head>  
20 -<body>  
21 - <!-- This script installs service_worker.js to provide PWA functionality to  
22 - application. For more information, see:  
23 - https://developers.google.com/web/fundamentals/primers/service-workers -->  
24 - <script>  
25 - if ('serviceWorker' in navigator) {  
26 - window.addEventListener('load', function () {  
27 - navigator.serviceWorker.register('flutter_service_worker.js');  
28 - });  
29 - }  
30 - </script>  
31 - <script src="main.dart.js" type="application/javascript"></script>  
32 -</body>  
33 -</html>  
1 -{  
2 - "name": "example",  
3 - "short_name": "example",  
4 - "start_url": ".",  
5 - "display": "standalone",  
6 - "background_color": "#0175C2",  
7 - "theme_color": "#0175C2",  
8 - "description": "A new Flutter project.",  
9 - "orientation": "portrait-primary",  
10 - "prefer_related_applications": false,  
11 - "icons": [  
12 - {  
13 - "src": "icons/Icon-192.png",  
14 - "sizes": "192x192",  
15 - "type": "image/png"  
16 - },  
17 - {  
18 - "src": "icons/Icon-512.png",  
19 - "sizes": "512x512",  
20 - "type": "image/png"  
21 - }  
22 - ]  
23 -}  
@@ -184,4 +184,3 @@ class SizeTransitions { @@ -184,4 +184,3 @@ class SizeTransitions {
184 ); 184 );
185 } 185 }
186 } 186 }
187 -  
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:collection'; 2 import 'dart:collection';
3 -import 'package:meta/meta.dart'; 3 +import 'package:flutter/foundation.dart';
4 4
5 import '../rx_core/rx_interface.dart'; 5 import '../rx_core/rx_interface.dart';
6 part 'rx_num.dart'; 6 part 'rx_num.dart';
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:collection'; 2 import 'dart:collection';
3 import 'dart:math'; 3 import 'dart:math';
4 -import 'package:meta/meta.dart'; 4 +import 'package:flutter/foundation.dart';
5 5
6 import '../rx_core/rx_impl.dart'; 6 import '../rx_core/rx_impl.dart';
7 import '../rx_core/rx_interface.dart'; 7 import '../rx_core/rx_interface.dart';
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:collection'; 2 import 'dart:collection';
3 -import 'package:meta/meta.dart';  
4 - 3 +import 'package:flutter/foundation.dart';
5 import '../rx_core/rx_impl.dart'; 4 import '../rx_core/rx_impl.dart';
6 import '../rx_core/rx_interface.dart'; 5 import '../rx_core/rx_interface.dart';
7 import '../rx_typedefs/rx_typedefs.dart'; 6 import '../rx_typedefs/rx_typedefs.dart';
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:collection'; 2 import 'dart:collection';
3 -import 'package:meta/meta.dart'; 3 +import 'package:flutter/foundation.dart';
4 4
5 import '../rx_core/rx_impl.dart'; 5 import '../rx_core/rx_impl.dart';
6 import '../rx_core/rx_interface.dart'; 6 import '../rx_core/rx_interface.dart';
1 -# Miscellaneous  
2 -*.class  
3 -*.log  
4 -*.pyc  
5 -*.swp  
6 -.DS_Store  
7 -.atom/  
8 -.buildlog/  
9 -.history  
10 -.svn/  
11 -  
12 -# IntelliJ related  
13 -*.iml  
14 -*.ipr  
15 -*.iws  
16 -.idea/  
17 -  
18 -# The .vscode folder contains launch configuration and tasks you configure in  
19 -# VS Code which you may wish to be included in version control, so this line  
20 -# is commented out by default.  
21 -#.vscode/  
22 -  
23 -# Flutter/Dart/Pub related  
24 -**/doc/api/  
25 -.dart_tool/  
26 -.flutter-plugins  
27 -.flutter-plugins-dependencies  
28 -.packages  
29 -.pub-cache/  
30 -.pub/  
31 -build/  
32 -  
33 -# Android related  
34 -**/android/**/gradle-wrapper.jar  
35 -**/android/.gradle  
36 -**/android/captures/  
37 -**/android/gradlew  
38 -**/android/gradlew.bat  
39 -**/android/local.properties  
40 -**/android/**/GeneratedPluginRegistrant.java  
41 -  
42 -# iOS/XCode related  
43 -**/ios/**/*.mode1v3  
44 -**/ios/**/*.mode2v3  
45 -**/ios/**/*.moved-aside  
46 -**/ios/**/*.pbxuser  
47 -**/ios/**/*.perspectivev3  
48 -**/ios/**/*sync/  
49 -**/ios/**/.sconsign.dblite  
50 -**/ios/**/.tags*  
51 -**/ios/**/.vagrant/  
52 -**/ios/**/DerivedData/  
53 -**/ios/**/Icon?  
54 -**/ios/**/Pods/  
55 -**/ios/**/.symlinks/  
56 -**/ios/**/profile  
57 -**/ios/**/xcuserdata  
58 -**/ios/.generated/  
59 -**/ios/Flutter/App.framework  
60 -**/ios/Flutter/Flutter.framework  
61 -**/ios/Flutter/Flutter.podspec  
62 -**/ios/Flutter/Generated.xcconfig  
63 -**/ios/Flutter/app.flx  
64 -**/ios/Flutter/app.zip  
65 -**/ios/Flutter/flutter_assets/  
66 -**/ios/Flutter/flutter_export_environment.sh  
67 -**/ios/ServiceDefinitions.json  
68 -**/ios/Runner/GeneratedPluginRegistrant.*  
69 -  
70 -# Exceptions to above rules.  
71 -!**/ios/**/default.mode1v3  
72 -!**/ios/**/default.mode2v3  
73 -!**/ios/**/default.pbxuser  
74 -!**/ios/**/default.perspectivev3  
1 -# This file tracks properties of this Flutter project.  
2 -# Used by Flutter tool to assess capabilities and perform upgrades etc.  
3 -#  
4 -# This file should be version controlled and should not be manually edited.  
5 -  
6 -version:  
7 - revision: a27c242b0eea731317cfec5bbdd9d35452ab3ecb  
8 - channel: dev  
9 -  
10 -project_type: package  
1 -## [3.13.0]  
2 -* Bump to Get 3.13.0  
3 -  
4 -## [3.12.0]  
5 -* Bump to Get 3.12.0  
6 -  
7 -## [3.10.2]  
8 -  
9 -* Initial release  
1 -MIT License  
2 -  
3 -Copyright (c) 2019 Jonny Borges  
4 -  
5 -Permission is hereby granted, free of charge, to any person obtaining a copy  
6 -of this software and associated documentation files (the "Software"), to deal  
7 -in the Software without restriction, including without limitation the rights  
8 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
9 -copies of the Software, and to permit persons to whom the Software is  
10 -furnished to do so, subject to the following conditions:  
11 -  
12 -The above copyright notice and this permission notice shall be included in all  
13 -copies or substantial portions of the Software.  
14 -  
15 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
16 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
17 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
18 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
19 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
20 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
21 -SOFTWARE.  
1 -# get_core  
2 -  
3 -A new Flutter package project.  
4 -  
5 -## Getting Started  
6 -  
7 -This project is a starting point for a Dart  
8 -[package](https://flutter.dev/developing-packages/),  
9 -a library module containing code that can be shared easily across  
10 -multiple Flutter or Dart projects.  
11 -  
12 -For help getting started with Flutter, view our  
13 -[online documentation](https://flutter.dev/docs), which offers tutorials,  
14 -samples, guidance on mobile development, and a full API reference.  
1 -# Include option is buggy:  
2 -# https://github.com/flutter/flutter/issues/62591  
3 -# In case the include issue gets fixed, lines below INCLUDE_FIX  
4 -# can be removed  
5 -  
6 -# include: package:effective_dart/analysis_options.1.2.0.yaml  
7 -analyzer:  
8 - strong-mode:  
9 - implicit-casts: false  
10 -linter:  
11 - rules:  
12 - await_only_futures: true  
13 - # This one is desirable, but that's a lot of work for now  
14 - public_member_api_docs: false  
15 - # Desirable, but would be breaking changes:  
16 - avoid_positional_boolean_parameters: false  
17 - constant_identifier_names: false  
18 - include_file_not_found: false  
19 -  
20 - # INCLUDE_FIX (copy of effective dart 1.2.0)  
21 - # STYLE  
22 - camel_case_types: true  
23 - camel_case_extensions: true  
24 - library_names: true  
25 - file_names: true  
26 - library_prefixes: true  
27 - non_constant_identifier_names: true  
28 - directives_ordering: true  
29 - lines_longer_than_80_chars: true # avoid  
30 - curly_braces_in_flow_control_structures: true  
31 -  
32 - # DOCUMENTATION  
33 - slash_for_doc_comments: true  
34 - package_api_docs: true # prefer  
35 - #- comment_references # Unused because https://github.com/dart-lang/sdk/issues/36974  
36 -  
37 - # USAGE  
38 - implementation_imports: true  
39 - avoid_relative_lib_imports: true # prefer  
40 - prefer_relative_imports: true # prefer  
41 - prefer_adjacent_string_concatenation: true  
42 - prefer_interpolation_to_compose_strings: true # prefer  
43 - unnecessary_brace_in_string_interps: true # avoid  
44 - prefer_collection_literals: true  
45 - avoid_function_literals_in_foreach_calls: true # avoid  
46 - prefer_iterable_whereType: true  
47 - prefer_function_declarations_over_variables: true  
48 - unnecessary_lambdas: true  
49 - prefer_equal_for_default_values: true  
50 - avoid_init_to_null: true  
51 - unnecessary_getters_setters: true  
52 - #- unnecessary_getters # prefer # Disabled pending fix: https://github.com/dart-lang/linter/issues/23  
53 - #- prefer_expression_function_bodies # consider  
54 - unnecessary_this: true  
55 - prefer_initializing_formals: true  
56 - type_init_formals: true  
57 - empty_constructor_bodies: true  
58 - unnecessary_new: true  
59 - unnecessary_const: true  
60 - avoid_catches_without_on_clauses: true # avoid  
61 - avoid_catching_errors: true  
62 - use_rethrow_when_possible: true  
63 -  
64 - # DESIGN  
65 - use_to_and_as_if_applicable: true # prefer  
66 - one_member_abstracts: true # avoid  
67 - avoid_classes_with_only_static_members: true # avoid  
68 - prefer_mixin: true  
69 - prefer_final_fields: true # prefer  
70 - use_setters_to_change_properties: true  
71 - avoid_setters_without_getters: true  
72 - avoid_returning_null: true # avoid  
73 - avoid_returning_this: true # avoid  
74 - type_annotate_public_apis: true # prefer  
75 - #- prefer_typing_uninitialized_variables # consider  
76 - omit_local_variable_types: true # avoid  
77 - avoid_types_on_closure_parameters: true # avoid  
78 - avoid_return_types_on_setters: true # avoid  
79 - prefer_generic_function_type_aliases: true  
80 - avoid_private_typedef_functions: true # prefer  
81 - #- use_function_type_syntax_for_parameters # consider  
82 - hash_and_equals: true  
83 - avoid_equals_and_hash_code_on_mutable_classes: true # avoid  
84 - avoid_null_checks_in_equality_operators: true  
85 -  
1 -library get_core;  
2 -  
3 -export 'src/get_interface.dart';  
4 -export 'src/get_main.dart';  
5 -export 'src/log.dart';  
6 -  
7 -export 'src/smart_management.dart';  
1 -import 'log.dart';  
2 -import 'smart_management.dart';  
3 -  
4 -/// GetInterface allows any auxiliary package to be merged into the "Get"  
5 -/// class through extensions  
6 -abstract class GetInterface {  
7 - SmartManagement smartManagement = SmartManagement.full;  
8 - String reference;  
9 - bool isLogEnable = true;  
10 - LogWriterCallback log = defaultLogWriterCallback;  
11 -}  
1 -import 'get_interface.dart';  
2 -  
3 -///Use to instead of Navigator.push, off instead of Navigator.pushReplacement,  
4 -///offAll instead of Navigator.pushAndRemoveUntil. For named routes just  
5 -///add "named" after them. Example: toNamed, offNamed, and AllNamed.  
6 -///To return to the previous screen, use back().  
7 -///No need to pass any context to Get, just put the name of the route inside  
8 -///the parentheses and the magic will occur.  
9 -class _GetImpl extends GetInterface {}  
10 -  
11 -// ignore: non_constant_identifier_names  
12 -final Get = _GetImpl();  
1 -import 'dart:developer' as developer;  
2 -import 'get_main.dart';  
3 -  
4 -///Voidcallback from logs  
5 -typedef LogWriterCallback = void Function(String text, {bool isError});  
6 -  
7 -/// default logger from GetX  
8 -void defaultLogWriterCallback(String value, {bool isError = false}) {  
9 - if (isError || Get.isLogEnable) developer.log(value, name: 'GETX');  
10 -}  
1 -/// GetX by default disposes unused controllers from memory,  
2 -/// Through different behaviors.  
3 -/// SmartManagement.full  
4 -/// [SmartManagement.full] is the default one. Dispose classes that are  
5 -/// not being used and were not set to be permanent. In the majority  
6 -/// of the cases you will want to keep this config untouched.  
7 -/// If you new to GetX then don't change this.  
8 -/// [SmartManagement.onlyBuilders] only controllers started in init:  
9 -/// or loaded into a Binding with Get.lazyPut() will be disposed. If you use  
10 -/// Get.put() or Get.putAsync() or any other approach, SmartManagement  
11 -/// will not have permissions to exclude this dependency. With the default  
12 -/// behavior, even widgets instantiated with "Get.put" will be removed,  
13 -/// unlike SmartManagement.onlyBuilders.  
14 -/// [SmartManagement.keepFactory]Just like SmartManagement.full,  
15 -/// it will remove it's dependencies when it's not being used anymore.  
16 -/// However, it will keep their factory, which means it will recreate  
17 -/// the dependency if you need that instance again.  
18 -enum SmartManagement {  
19 - full,  
20 - onlyBuilder,  
21 - keepFactory,  
22 -}  
1 -name: get_core  
2 -description: A base package from allow use resources from GetX™ framework.  
3 -version: 3.13.0  
4 -homepage: https://github.com/jonataslaw/getx  
5 -  
6 -environment:  
7 - sdk: ">=2.7.0 <3.0.0"  
8 -  
9 -dependencies:  
10 -  
11 -  
12 -dev_dependencies:  
13 -  
14 -  
15 -# For information on the generic Dart part of this file, see the  
16 -# following page: https://dart.dev/tools/pub/pubspec  
17 -  
18 -# The following section is specific to Flutter.  
19 -flutter:  
20 -  
21 - # To add assets to your package, add an assets section, like this:  
22 - # assets:  
23 - # - images/a_dot_burr.jpeg  
24 - # - images/a_dot_ham.jpeg  
25 - #  
26 - # For details regarding assets in packages, see  
27 - # https://flutter.dev/assets-and-images/#from-packages  
28 - #  
29 - # An image asset can refer to one or more resolution-specific "variants", see  
30 - # https://flutter.dev/assets-and-images/#resolution-aware.  
31 -  
32 - # To add custom fonts to your package, add a fonts section here,  
33 - # in this "flutter" section. Each entry in this list should have a  
34 - # "family" key with the font family name, and a "fonts" key with a  
35 - # list giving the asset and other descriptors for the font. For  
36 - # example:  
37 - # fonts:  
38 - # - family: Schyler  
39 - # fonts:  
40 - # - asset: fonts/Schyler-Regular.ttf  
41 - # - asset: fonts/Schyler-Italic.ttf  
42 - # style: italic  
43 - # - family: Trajan Pro  
44 - # fonts:  
45 - # - asset: fonts/TrajanPro.ttf  
46 - # - asset: fonts/TrajanPro_Bold.ttf  
47 - # weight: 700  
48 - #  
49 - # For details regarding fonts in packages, see  
50 - # https://flutter.dev/custom-fonts/#from-packages  
1 -# Miscellaneous  
2 -*.class  
3 -*.log  
4 -*.pyc  
5 -*.swp  
6 -.DS_Store  
7 -.atom/  
8 -.buildlog/  
9 -.history  
10 -.svn/  
11 -  
12 -# IntelliJ related  
13 -*.iml  
14 -*.ipr  
15 -*.iws  
16 -.idea/  
17 -  
18 -# The .vscode folder contains launch configuration and tasks you configure in  
19 -# VS Code which you may wish to be included in version control, so this line  
20 -# is commented out by default.  
21 -#.vscode/  
22 -  
23 -# Flutter/Dart/Pub related  
24 -**/doc/api/  
25 -.dart_tool/  
26 -.flutter-plugins  
27 -.flutter-plugins-dependencies  
28 -.packages  
29 -.pub-cache/  
30 -.pub/  
31 -build/  
32 -  
33 -# Android related  
34 -**/android/**/gradle-wrapper.jar  
35 -**/android/.gradle  
36 -**/android/captures/  
37 -**/android/gradlew  
38 -**/android/gradlew.bat  
39 -**/android/local.properties  
40 -**/android/**/GeneratedPluginRegistrant.java  
41 -  
42 -# iOS/XCode related  
43 -**/ios/**/*.mode1v3  
44 -**/ios/**/*.mode2v3  
45 -**/ios/**/*.moved-aside  
46 -**/ios/**/*.pbxuser  
47 -**/ios/**/*.perspectivev3  
48 -**/ios/**/*sync/  
49 -**/ios/**/.sconsign.dblite  
50 -**/ios/**/.tags*  
51 -**/ios/**/.vagrant/  
52 -**/ios/**/DerivedData/  
53 -**/ios/**/Icon?  
54 -**/ios/**/Pods/  
55 -**/ios/**/.symlinks/  
56 -**/ios/**/profile  
57 -**/ios/**/xcuserdata  
58 -**/ios/.generated/  
59 -**/ios/Flutter/App.framework  
60 -**/ios/Flutter/Flutter.framework  
61 -**/ios/Flutter/Flutter.podspec  
62 -**/ios/Flutter/Generated.xcconfig  
63 -**/ios/Flutter/app.flx  
64 -**/ios/Flutter/app.zip  
65 -**/ios/Flutter/flutter_assets/  
66 -**/ios/Flutter/flutter_export_environment.sh  
67 -**/ios/ServiceDefinitions.json  
68 -**/ios/Runner/GeneratedPluginRegistrant.*  
69 -  
70 -# Exceptions to above rules.  
71 -!**/ios/**/default.mode1v3  
72 -!**/ios/**/default.mode2v3  
73 -!**/ios/**/default.pbxuser  
74 -!**/ios/**/default.perspectivev3  
1 -# This file tracks properties of this Flutter project.  
2 -# Used by Flutter tool to assess capabilities and perform upgrades etc.  
3 -#  
4 -# This file should be version controlled and should not be manually edited.  
5 -  
6 -version:  
7 - revision: a27c242b0eea731317cfec5bbdd9d35452ab3ecb  
8 - channel: dev  
9 -  
10 -project_type: package  
1 -## [3.13.0]  
2 -* Bump to Get 3.13.0  
3 -  
4 -## [3.12.0]  
5 -* Bump to Get 3.12.0  
6 -  
7 -## [3.10.2]  
8 -- Initial release  
1 -MIT License  
2 -  
3 -Copyright (c) 2019 Jonny Borges  
4 -  
5 -Permission is hereby granted, free of charge, to any person obtaining a copy  
6 -of this software and associated documentation files (the "Software"), to deal  
7 -in the Software without restriction, including without limitation the rights  
8 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
9 -copies of the Software, and to permit persons to whom the Software is  
10 -furnished to do so, subject to the following conditions:  
11 -  
12 -The above copyright notice and this permission notice shall be included in all  
13 -copies or substantial portions of the Software.  
14 -  
15 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
16 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
17 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
18 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
19 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
20 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
21 -SOFTWARE.  
1 -# get_instance  
2 -  
3 -A new Flutter package project.  
4 -  
5 -## Getting Started  
6 -  
7 -This project is a starting point for a Dart  
8 -[package](https://flutter.dev/developing-packages/),  
9 -a library module containing code that can be shared easily across  
10 -multiple Flutter or Dart projects.  
11 -  
12 -For help getting started with Flutter, view our  
13 -[online documentation](https://flutter.dev/docs), which offers tutorials,  
14 -samples, guidance on mobile development, and a full API reference.  
1 -# Include option is buggy:  
2 -# https://github.com/flutter/flutter/issues/62591  
3 -# In case the include issue gets fixed, lines below INCLUDE_FIX  
4 -# can be removed  
5 -  
6 -# include: package:effective_dart/analysis_options.1.2.0.yaml  
7 -analyzer:  
8 - strong-mode:  
9 - implicit-casts: false  
10 -linter:  
11 - rules:  
12 - await_only_futures: true  
13 - # This one is desirable, but that's a lot of work for now  
14 - public_member_api_docs: false  
15 - # Desirable, but would be breaking changes:  
16 - avoid_positional_boolean_parameters: false  
17 - constant_identifier_names: false  
18 - include_file_not_found: false  
19 -  
20 - # INCLUDE_FIX (copy of effective dart 1.2.0)  
21 - # STYLE  
22 - camel_case_types: true  
23 - camel_case_extensions: true  
24 - library_names: true  
25 - file_names: true  
26 - library_prefixes: true  
27 - non_constant_identifier_names: true  
28 - directives_ordering: true  
29 - lines_longer_than_80_chars: true # avoid  
30 - curly_braces_in_flow_control_structures: true  
31 -  
32 - # DOCUMENTATION  
33 - slash_for_doc_comments: true  
34 - package_api_docs: true # prefer  
35 - #- comment_references # Unused because https://github.com/dart-lang/sdk/issues/36974  
36 -  
37 - # USAGE  
38 - implementation_imports: true  
39 - avoid_relative_lib_imports: true # prefer  
40 - prefer_relative_imports: true # prefer  
41 - prefer_adjacent_string_concatenation: true  
42 - prefer_interpolation_to_compose_strings: true # prefer  
43 - unnecessary_brace_in_string_interps: true # avoid  
44 - prefer_collection_literals: true  
45 - avoid_function_literals_in_foreach_calls: true # avoid  
46 - prefer_iterable_whereType: true  
47 - prefer_function_declarations_over_variables: true  
48 - unnecessary_lambdas: true  
49 - prefer_equal_for_default_values: true  
50 - avoid_init_to_null: true  
51 - unnecessary_getters_setters: true  
52 - #- unnecessary_getters # prefer # Disabled pending fix: https://github.com/dart-lang/linter/issues/23  
53 - #- prefer_expression_function_bodies # consider  
54 - unnecessary_this: true  
55 - prefer_initializing_formals: true  
56 - type_init_formals: true  
57 - empty_constructor_bodies: true  
58 - unnecessary_new: true  
59 - unnecessary_const: true  
60 - avoid_catches_without_on_clauses: true # avoid  
61 - avoid_catching_errors: true  
62 - use_rethrow_when_possible: true  
63 -  
64 - # DESIGN  
65 - use_to_and_as_if_applicable: true # prefer  
66 - one_member_abstracts: true # avoid  
67 - avoid_classes_with_only_static_members: true # avoid  
68 - prefer_mixin: true  
69 - prefer_final_fields: true # prefer  
70 - use_setters_to_change_properties: true  
71 - avoid_setters_without_getters: true  
72 - avoid_returning_null: true # avoid  
73 - avoid_returning_this: true # avoid  
74 - type_annotate_public_apis: true # prefer  
75 - #- prefer_typing_uninitialized_variables # consider  
76 - omit_local_variable_types: true # avoid  
77 - avoid_types_on_closure_parameters: true # avoid  
78 - avoid_return_types_on_setters: true # avoid  
79 - prefer_generic_function_type_aliases: true  
80 - avoid_private_typedef_functions: true # prefer  
81 - #- use_function_type_syntax_for_parameters # consider  
82 - hash_and_equals: true  
83 - avoid_equals_and_hash_code_on_mutable_classes: true # avoid  
84 - avoid_null_checks_in_equality_operators: true  
85 -  
1 -import 'package:get_instance/get_instance.dart';  
2 -  
3 -void main() {  
4 - Get.put(Foo());  
5 -  
6 - final foo = Get.find<Foo>();  
7 - final foo2 = Get.find<Foo>();  
8 - print(foo == foo2); // true  
9 -}  
10 -  
11 -class Foo {}  
1 -export 'package:get_core/get_core.dart';  
2 -export 'src/bindings_interface.dart';  
3 -export 'src/extension_instance.dart';  
4 -export 'src/get_instance.dart';  
5 -export 'src/lifecycle.dart';  
1 -import 'get_instance.dart';  
2 -  
3 -/// [Bindings] should be extended or implemented.  
4 -/// When using [GetMaterialApp], all [GetPage]s and navigation  
5 -/// methods (like Get.to()) have a [binding] property that takes an  
6 -/// instance of Bindings to manage the  
7 -/// dependencies() (via [Get.put()]) for the Route you are opening.  
8 -// ignore: one_member_abstracts  
9 -abstract class Bindings {  
10 - void dependencies();  
11 -}  
12 -  
13 -/// Simplifies Bindings generation from a single callback.  
14 -/// To avoid the creation of a custom Binding instance per route.  
15 -///  
16 -/// Example:  
17 -/// ```  
18 -/// GetPage(  
19 -/// name: '/',  
20 -/// page: () => Home(),  
21 -/// // This might cause you an error.  
22 -/// // binding: BindingsBuilder(() => Get.put(HomeController())),  
23 -/// binding: BindingsBuilder(() { Get.put(HomeController(); })),  
24 -/// // Using .lazyPut() works fine.  
25 -/// // binding: BindingsBuilder(() => Get.lazyPut(() => HomeController())),  
26 -/// ),  
27 -/// ```  
28 -class BindingsBuilder<T> extends Bindings {  
29 - /// Register your dependencies in the [builder] callback.  
30 - final BindingBuilderCallback builder;  
31 -  
32 - /// Shortcut to register 1 Controller with Get.put(),  
33 - /// Prevents the issue of the fat arrow function with the constructor.  
34 - /// BindingsBuilder(() => Get.put(HomeController())),  
35 - ///  
36 - /// Sample:  
37 - /// ```  
38 - /// GetPage(  
39 - /// name: '/',  
40 - /// page: () => Home(),  
41 - /// binding: BindingsBuilder.put(() => HomeController()),  
42 - /// ),  
43 - /// ```  
44 - factory BindingsBuilder.put(InstanceBuilderCallback<T> builder,  
45 - {String tag, bool permanent = false}) {  
46 - return BindingsBuilder(() => GetInstance()  
47 - .put<T>(null, tag: tag, permanent: permanent, builder: builder));  
48 - }  
49 -  
50 - /// WARNING: don't use `()=> Get.put(Controller())`,  
51 - /// if only passing 1 callback use `BindingsBuilder.put(Controller())`  
52 - /// or `BindingsBuilder(()=> Get.lazyPut(Controller()))`  
53 - BindingsBuilder(this.builder);  
54 -  
55 - @override  
56 - void dependencies() {  
57 - builder();  
58 - }  
59 -}  
60 -  
61 -// abstract class INavigation {}  
62 -// typedef Snack = Function();  
63 -// typedef Modal = Function();  
64 -// typedef Route = Function();  
65 -typedef BindingBuilderCallback = void Function();  
1 -import 'package:get_core/get_core.dart';  
2 -  
3 -import 'get_instance.dart';  
4 -  
5 -extension Inst on GetInterface {  
6 - /// Creates a new Instance<S> lazily from the [<S>builder()] callback.  
7 - ///  
8 - /// The first time you call [Get.find()], the [builder()] callback will create  
9 - /// the Instance and persisted as a Singleton (like you would use  
10 - /// [Get.put()]).  
11 - ///  
12 - /// Using [Get.smartManagement] as [SmartManagement.keepFactory] has  
13 - /// the same outcome  
14 - /// as using [fenix:true] :  
15 - /// The internal register of [builder()] will remain in memory to recreate  
16 - /// the Instance if the Instance has been removed with [Get.delete()].  
17 - /// Therefore, future calls to [Get.find()] will return the same Instance.  
18 - ///  
19 - /// If you need to make use of GetxController's life-cycle  
20 - /// ([onInit(), onStart(), onClose()])  
21 - /// [fenix] is a great choice to mix with [GetBuilder()] and [GetX()] widgets,  
22 - /// and/or [GetMaterialApp] Navigation.  
23 - ///  
24 - /// You could use [Get.lazyPut(fenix:true)] in your app's [main()] instead of  
25 - /// [Bindings()] for each [GetPage].  
26 - /// And the memory management will be similar.  
27 - ///  
28 - /// Subsequent calls to [Get.lazyPut()] with the same parameters  
29 - /// (<[S]> and optionally [tag] will **not** override the original).  
30 - void lazyPut<S>(InstanceBuilderCallback<S> builder,  
31 - {String tag, bool fenix = false}) {  
32 - GetInstance().lazyPut<S>(builder, tag: tag, fenix: fenix);  
33 - }  
34 -  
35 - /// async version of [Get.put()].  
36 - /// Awaits for the resolution of the Future from [builder()] parameter and  
37 - /// stores the Instance returned.  
38 - Future<S> putAsync<S>(AsyncInstanceBuilderCallback<S> builder,  
39 - {String tag, bool permanent = false}) async =>  
40 - GetInstance().putAsync<S>(builder, tag: tag, permanent: permanent);  
41 -  
42 - /// Creates a new Class Instance [S] from the builder callback[S].  
43 - /// Every time [find]<[S]>() is used, it calls the builder method to generate  
44 - /// a new Instance [S].  
45 - /// It also registers each [instance.onClose()] with the current  
46 - /// Route [GetConfig.currentRoute] to keep the lifecycle active.  
47 - /// Is important to know that the instances created are only stored per Route.  
48 - /// So, if you call `Get.delete<T>()` the "instance factory" used in this  
49 - /// method ([Get.create<T>()]) will be removed, but NOT the instances  
50 - /// already created by it.  
51 - /// Uses `tag` as the other methods.  
52 - ///  
53 - /// Example:  
54 - ///  
55 - /// ```create(() => Repl());  
56 - /// Repl a = find();  
57 - /// Repl b = find();  
58 - /// print(a==b); (false)```  
59 - void create<S>(InstanceBuilderCallback<S> builder,  
60 - {String tag, bool permanent = true}) =>  
61 - GetInstance().create<S>(builder, tag: tag, permanent: permanent);  
62 -  
63 - /// Finds a Instance of the required Class <[S]>(or [tag])  
64 - /// In the case of using [Get.create()], it will generate an Instance  
65 - /// each time you call [Get.find()].  
66 - S find<S>({String tag}) => GetInstance().find<S>(tag: tag);  
67 -  
68 - /// Injects an [Instance<S>] in memory.  
69 - ///  
70 - /// No need to define the generic type <[S]> as it's inferred  
71 - /// from the [dependency] parameter.  
72 - ///  
73 - /// - [dependency] The Instance to be injected.  
74 - /// - [tag] optionally, use a [tag] as an "id" to create multiple records  
75 - /// of the same Type<[S]> the [tag] does **not** conflict with the same tags  
76 - /// used by other [dependencies] Types.  
77 - /// - [permanent] keeps the Instance in memory and persist it,  
78 - /// not following [Get.smartManagement]  
79 - /// rules. Although, can be removed by [GetInstance.reset()]  
80 - /// and [Get.delete()]  
81 - /// - [builder] If defined, the [dependency] must be returned from here  
82 - S put<S>(S dependency,  
83 - {String tag,  
84 - bool permanent = false,  
85 - InstanceBuilderCallback<S> builder}) =>  
86 - GetInstance()  
87 - .put<S>(dependency, tag: tag, permanent: permanent, builder: builder);  
88 -  
89 - /// Clears all registered instances (and/or tags).  
90 - /// Even the persistent ones.  
91 - ///  
92 - /// - [clearFactory] clears the callbacks registered by [Get.lazyPut()]  
93 - /// - [clearRouteBindings] clears Instances associated with Routes when using  
94 - /// [GetMaterialApp].  
95 - bool reset({bool clearFactory = true, bool clearRouteBindings = true}) =>  
96 - GetInstance().reset(  
97 - clearFactory: clearFactory, clearRouteBindings: clearRouteBindings);  
98 -  
99 - /// Deletes the Instance<[S]>, cleaning the memory and closes any open  
100 - /// controllers ([DisposableInterface]).  
101 - ///  
102 - /// - [tag] Optional "tag" used to register the Instance  
103 - /// - [force] Will delete an Instance even if marked as [permanent].  
104 - Future<bool> delete<S>({String tag, bool force = false}) async =>  
105 - GetInstance().delete<S>(tag: tag, force: force);  
106 -  
107 - /// Checks if a Class Instance<[S]> (or [tag]) is registered in memory.  
108 - /// - [tag] optional, if you use a [tag] to register the Instance.  
109 - bool isRegistered<S>({String tag}) => GetInstance().isRegistered<S>(tag: tag);  
110 -  
111 - /// Checks if an Instance<[S]> (or [tag]) returned from a factory builder  
112 - /// [Get.lazyPut()], is registered in memory.  
113 - /// - [tag] optional, if you use a [tag] to register the Instance.  
114 - bool isPrepared<S>({String tag}) => GetInstance().isPrepared<S>(tag: tag);  
115 -}  
1 -import 'dart:async';  
2 -import 'dart:collection';  
3 -  
4 -import 'package:get_core/get_core.dart';  
5 -  
6 -import 'lifecycle.dart';  
7 -  
8 -class GetInstance {  
9 - factory GetInstance() => _getInstance ??= GetInstance._();  
10 -  
11 - const GetInstance._();  
12 -  
13 - static GetInstance _getInstance;  
14 -  
15 - /// Holds references to every registered Instance when using  
16 - /// [Get.put()]  
17 - static final Map<String, _InstanceBuilderFactory> _singl = {};  
18 -  
19 - /// Holds a reference to every registered callback when using  
20 - /// [Get.lazyPut()]  
21 - static final Map<String, _Lazy> _factory = {};  
22 -  
23 - /// Holds a reference to [Get.reference] when the Instance was  
24 - /// created to manage the memory.  
25 - static final Map<String, String> _routesKey = {};  
26 -  
27 - /// Stores the onClose() references of instances created with [Get.create()]  
28 - /// using the [Get.reference].  
29 - /// Experimental feature to keep the lifecycle and memory management with  
30 - /// non-singleton instances.  
31 - static final Map<String, HashSet<Function>> _routesByCreate = {};  
32 -  
33 - /// Creates a new Instance<S> lazily from the [<S>builder()] callback.  
34 - ///  
35 - /// The first time you call [Get.find()], the [builder()] callback will create  
36 - /// the Instance and persisted as a Singleton (like you would  
37 - /// use [Get.put()]).  
38 - ///  
39 - /// Using [Get.smartManagement] as [SmartManagement.keepFactory] has  
40 - /// the same outcome as using [fenix:true] :  
41 - /// The internal register of [builder()] will remain in memory to recreate  
42 - /// the Instance if the Instance has been removed with [Get.delete()].  
43 - /// Therefore, future calls to [Get.find()] will return the same Instance.  
44 - ///  
45 - /// If you need to make use of GetxController's life-cycle  
46 - /// ([onInit(), onStart(), onClose()]) [fenix] is a great choice to mix with  
47 - /// [GetBuilder()] and [GetX()] widgets, and/or [GetMaterialApp] Navigation.  
48 - ///  
49 - /// You could use [Get.lazyPut(fenix:true)] in your app's [main()] instead  
50 - /// of [Bindings()] for each [GetPage].  
51 - /// And the memory management will be similar.  
52 - ///  
53 - /// Subsequent calls to [Get.lazyPut()] with the same parameters  
54 - /// (<[S]> and optionally [tag] will **not** override the original).  
55 - void lazyPut<S>(  
56 - InstanceBuilderCallback<S> builder, {  
57 - String tag,  
58 - bool fenix = false,  
59 - }) {  
60 - final key = _getKey(S, tag);  
61 - _factory.putIfAbsent(key, () => _Lazy(builder, fenix));  
62 - }  
63 -  
64 - /// async version of [Get.put()].  
65 - /// Awaits for the resolution of the Future from [builder()] parameter and  
66 - /// stores the Instance returned.  
67 - Future<S> putAsync<S>(  
68 - AsyncInstanceBuilderCallback<S> builder, {  
69 - String tag,  
70 - bool permanent = false,  
71 - }) async {  
72 - return put<S>(await builder(), tag: tag, permanent: permanent);  
73 - }  
74 -  
75 - /// Injects an instance <[S]> in memory to be globally accessible.  
76 - ///  
77 - /// No need to define the generic type <[S]> as it's inferred from  
78 - /// the [dependency]  
79 - ///  
80 - /// - [dependency] The Instance to be injected.  
81 - /// - [tag] optionally, use a [tag] as an "id" to create multiple records of  
82 - /// the same Type<[S]>  
83 - /// - [permanent] keeps the Instance in memory, not following  
84 - /// [Get.smartManagement] rules.  
85 - S put<S>(  
86 - S dependency, {  
87 - String tag,  
88 - bool permanent = false,  
89 - InstanceBuilderCallback<S> builder,  
90 - }) {  
91 - _insert(  
92 - isSingleton: true,  
93 - name: tag,  
94 - permanent: permanent,  
95 - builder: builder ?? (() => dependency));  
96 - return find<S>(tag: tag);  
97 - }  
98 -  
99 - /// Creates a new Class Instance [S] from the builder callback[S].  
100 - /// Every time [find]<[S]>() is used, it calls the builder method to generate  
101 - /// a new Instance [S].  
102 - /// It also registers each [instance.onClose()] with the current  
103 - /// Route [Get.reference] to keep the lifecycle active.  
104 - /// Is important to know that the instances created are only stored per Route.  
105 - /// So, if you call `Get.delete<T>()` the "instance factory" used in this  
106 - /// method ([Get.create<T>()]) will be removed, but NOT the instances  
107 - /// already created by it.  
108 - ///  
109 - /// Example:  
110 - ///  
111 - /// ```create(() => Repl());  
112 - /// Repl a = find();  
113 - /// Repl b = find();  
114 - /// print(a==b); (false)```  
115 - void create<S>(  
116 - InstanceBuilderCallback<S> builder, {  
117 - String tag,  
118 - bool permanent = true,  
119 - }) {  
120 - _insert(  
121 - isSingleton: false, name: tag, builder: builder, permanent: permanent);  
122 - }  
123 -  
124 - /// Injects the Instance [S] builder into the [_singleton] HashMap.  
125 - void _insert<S>({  
126 - bool isSingleton,  
127 - String name,  
128 - bool permanent = false,  
129 - InstanceBuilderCallback<S> builder,  
130 - }) {  
131 - assert(builder != null);  
132 - final key = _getKey(S, name);  
133 - _singl.putIfAbsent(  
134 - key,  
135 - () =>  
136 - _InstanceBuilderFactory<S>(isSingleton, builder, permanent, false));  
137 - }  
138 -  
139 - /// Clears from memory registered Instances associated with [routeName] when  
140 - /// using [Get.smartManagement] as [SmartManagement.full] or  
141 - /// [SmartManagement.keepFactory]  
142 - /// Meant for internal usage of [GetPageRoute] and [GetDialogRoute]  
143 - void removeDependencyByRoute(String routeName) {  
144 - final keysToRemove = <String>[];  
145 - _routesKey.forEach((key, value) {  
146 - if (value == routeName) {  
147 - keysToRemove.add(key);  
148 - }  
149 - });  
150 -  
151 - /// Removes [Get.create()] instances registered in [routeName].  
152 - if (_routesByCreate.containsKey(routeName)) {  
153 - for (final onClose in _routesByCreate[routeName]) {  
154 - // assure the [DisposableInterface] instance holding a reference  
155 - // to [onClose()] wasn't disposed.  
156 - if (onClose != null) {  
157 - onClose();  
158 - }  
159 - }  
160 - _routesByCreate[routeName].clear();  
161 - _routesByCreate.remove(routeName);  
162 - }  
163 -  
164 - for (final element in keysToRemove) {  
165 - delete(key: element);  
166 - }  
167 -  
168 - for (final element in keysToRemove) {  
169 - _routesKey?.remove(element);  
170 - }  
171 - keysToRemove.clear();  
172 - }  
173 -  
174 - /// Initializes the dependencies for a Class Instance [S] (or tag),  
175 - /// If its a Controller, it starts the lifecycle process.  
176 - /// Optionally associating the current Route to the lifetime of the instance,  
177 - /// if [Get.smartManagement] is marked as [SmartManagement.full] or  
178 - /// [Get.keepFactory]  
179 - /// Only flags `isInit` if it's using `Get.create()`  
180 - /// (not for Singletons access).  
181 - /// Returns the instance if not initialized, required for Get.create() to  
182 - /// work properly.  
183 - S _initDependencies<S>({String name}) {  
184 - final key = _getKey(S, name);  
185 - final isInit = _singl[key].isInit;  
186 - S i;  
187 - if (!isInit) {  
188 - i = _startController<S>(tag: name);  
189 - if (_singl[key].isSingleton) {  
190 - _singl[key].isInit = true;  
191 - if (Get.smartManagement != SmartManagement.onlyBuilder) {  
192 - _registerRouteInstance<S>(tag: name);  
193 - }  
194 - }  
195 - }  
196 - return i;  
197 - }  
198 -  
199 - /// Links a Class instance [S] (or [tag]) to the current route.  
200 - /// Requires usage of [GetMaterialApp].  
201 - void _registerRouteInstance<S>({String tag}) {  
202 - _routesKey.putIfAbsent(_getKey(S, tag), () => Get.reference);  
203 - }  
204 -  
205 - /// Finds and returns a Instance<[S]> (or [tag]) without further processing.  
206 - S findByType<S>(Type type, {String tag}) {  
207 - final key = _getKey(type, tag);  
208 - return _singl[key].getDependency() as S;  
209 - }  
210 -  
211 - /// Initializes the controller  
212 - S _startController<S>({String tag}) {  
213 - final key = _getKey(S, tag);  
214 - final i = _singl[key].getDependency() as S;  
215 - if (i is GetLifeCycle) {  
216 - if (i.onStart != null) {  
217 - i.onStart();  
218 - Get.log('"$key" has been initialized');  
219 - }  
220 - if (!_singl[key].isSingleton && i.onClose != null) {  
221 - _routesByCreate[Get.reference] ??= HashSet<Function>();  
222 - _routesByCreate[Get.reference].add(i.onClose);  
223 - }  
224 - }  
225 - return i;  
226 - }  
227 -  
228 - S putOrFind<S>(InstanceBuilderCallback<S> dep, {String tag}) {  
229 - final key = _getKey(S, tag);  
230 -  
231 - if (_singl.containsKey(key)) {  
232 - return _singl[key].getDependency() as S;  
233 - } else {  
234 - if (_factory.containsKey(key)) {  
235 - final _value = put<S>((_factory[key].builder() as S), tag: tag);  
236 -  
237 - if (Get.smartManagement != SmartManagement.keepFactory) {  
238 - if (!_factory[key].fenix) {  
239 - _factory.remove(key);  
240 - }  
241 - }  
242 - return _value;  
243 - }  
244 -  
245 - return GetInstance().put(dep(), tag: tag);  
246 - }  
247 - }  
248 -  
249 - /// Finds the registered type <[S]> (or [tag])  
250 - /// In case of using Get.[create] to register a type <[S]> or [tag],  
251 - /// it will create an instance each time you call [find].  
252 - /// If the registered type <[S]> (or [tag]) is a Controller,  
253 - /// it will initialize it's lifecycle.  
254 - S find<S>({String tag}) {  
255 - final key = _getKey(S, tag);  
256 - if (isRegistered<S>(tag: tag)) {  
257 - if (_singl[key] == null) {  
258 - if (tag == null) {  
259 - throw 'Class "$S" is not registered';  
260 - } else {  
261 - throw 'Class "$S" with tag "$tag" is not registered';  
262 - }  
263 - }  
264 -  
265 - /// although dirty solution, the lifecycle starts inside  
266 - /// `initDependencies`, so we have to return the instance from there  
267 - /// to make it compatible with `Get.create()`.  
268 - final i = _initDependencies<S>(name: tag);  
269 - return i ?? _singl[key].getDependency() as S;  
270 - } else {  
271 - if (!_factory.containsKey(key)) {  
272 - // ignore: lines_longer_than_80_chars  
273 - throw '"$S" not found. You need to call "Get.put($S())" or "Get.lazyPut(()=>$S())"';  
274 - }  
275 -  
276 - Get.log('Lazy instance "$S" created');  
277 - final _value = put<S>(_factory[key].builder() as S, tag: tag);  
278 - _initDependencies<S>(name: tag);  
279 -  
280 - if (Get.smartManagement != SmartManagement.keepFactory &&  
281 - !_factory[key].fenix) {  
282 - _factory.remove(key);  
283 - }  
284 -  
285 - return _value;  
286 - }  
287 - }  
288 -  
289 - /// Generates the key based on [type] (and optionally a [name])  
290 - /// to register an Instance Builder in the hashmap.  
291 - String _getKey(Type type, String name) {  
292 - return name == null ? type.toString() : type.toString() + name;  
293 - }  
294 -  
295 - /// Clears all registered instances (and/or tags).  
296 - /// Even the persistent ones.  
297 - ///  
298 - /// [clearFactory] clears the callbacks registered by [lazyPut]  
299 - /// [clearRouteBindings] clears Instances associated with routes.  
300 - ///  
301 - bool reset({bool clearFactory = true, bool clearRouteBindings = true}) {  
302 - if (clearFactory) _factory.clear();  
303 - if (clearRouteBindings) _routesKey.clear();  
304 - _singl.clear();  
305 - return true;  
306 - }  
307 -  
308 - /// Delete registered Class Instance [S] (or [tag]) and, closes any open  
309 - /// controllers [DisposableInterface], cleans up the memory  
310 - ///  
311 - /// /// Deletes the Instance<[S]>, cleaning the memory.  
312 - // ///  
313 - // /// - [tag] Optional "tag" used to register the Instance  
314 - // /// - [key] For internal usage, is the processed key used to register  
315 - // /// the Instance. **don't use** it unless you know what you are doing.  
316 -  
317 - /// Deletes the Instance<[S]>, cleaning the memory and closes any open  
318 - /// controllers ([DisposableInterface]).  
319 - ///  
320 - /// - [tag] Optional "tag" used to register the Instance  
321 - /// - [key] For internal usage, is the processed key used to register  
322 - /// the Instance. **don't use** it unless you know what you are doing.  
323 - /// - [force] Will delete an Instance even if marked as [permanent].  
324 - bool delete<S>({String tag, String key, bool force = false}) {  
325 - // return _queue.secure<bool>(() {  
326 - return _delete<S>(tag: tag, key: key, force: force);  
327 - // });  
328 - }  
329 -  
330 - bool _delete<S>({String tag, String key, bool force = false}) {  
331 - final newKey = key ?? _getKey(S, tag);  
332 -  
333 - if (!_singl.containsKey(newKey)) {  
334 - Get.log('Instance "$newKey" already removed.', isError: true);  
335 - return false;  
336 - }  
337 -  
338 - final builder = _singl[newKey];  
339 - if (builder.permanent && !force) {  
340 - Get.log(  
341 - // ignore: lines_longer_than_80_chars  
342 - '"$newKey" has been marked as permanent, SmartManagement is not authorized to delete it.',  
343 - isError: true,  
344 - );  
345 - return false;  
346 - }  
347 - final i = builder.dependency;  
348 -  
349 - if (i is GetxServiceMixin && !force) {  
350 - return false;  
351 - }  
352 - if (i is GetLifeCycle) {  
353 - i.onClose();  
354 - Get.log('"$newKey" onClose() called');  
355 - }  
356 -  
357 - _singl.removeWhere((oldKey, value) => (oldKey == newKey));  
358 - if (_singl.containsKey(newKey)) {  
359 - Get.log('Error removing object "$newKey"', isError: true);  
360 - } else {  
361 - Get.log('"$newKey" deleted from memory');  
362 - }  
363 - // _routesKey?.remove(key);  
364 - return true;  
365 - }  
366 -  
367 - /// Check if a Class Instance<[S]> (or [tag]) is registered in memory.  
368 - /// - [tag] is optional, if you used a [tag] to register the Instance.  
369 - bool isRegistered<S>({String tag}) => _singl.containsKey(_getKey(S, tag));  
370 -  
371 - /// Checks if a lazy factory callback ([Get.lazyPut()] that returns an  
372 - /// Instance<[S]> is registered in memory.  
373 - /// - [tag] is optional, if you used a [tag] to register the lazy Instance.  
374 - bool isPrepared<S>({String tag}) => _factory.containsKey(_getKey(S, tag));  
375 -}  
376 -  
377 -typedef InstanceBuilderCallback<S> = S Function();  
378 -  
379 -typedef AsyncInstanceBuilderCallback<S> = Future<S> Function();  
380 -  
381 -/// Internal class to register instances with Get.[put]<[S]>().  
382 -class _InstanceBuilderFactory<S> {  
383 - /// Marks the Builder as a single instance.  
384 - /// For reusing [dependency] instead of [builderFunc]  
385 - bool isSingleton;  
386 -  
387 - /// Stores the actual object instance when [isSingleton]=true.  
388 - S dependency;  
389 -  
390 - /// Generates (and regenerates) the instance when [isSingleton]=false.  
391 - /// Usually used by factory methods  
392 - InstanceBuilderCallback<S> builderFunc;  
393 -  
394 - /// Flag to persist the instance in memory,  
395 - /// without considering [Get.smartManagement]  
396 - bool permanent = false;  
397 -  
398 - bool isInit = false;  
399 -  
400 - _InstanceBuilderFactory(  
401 - this.isSingleton,  
402 - this.builderFunc,  
403 - this.permanent,  
404 - this.isInit,  
405 - );  
406 -  
407 - /// Gets the actual instance by it's [builderFunc] or the persisted instance.  
408 - S getDependency() {  
409 - return isSingleton ? dependency ??= builderFunc() : builderFunc();  
410 - }  
411 -}  
412 -  
413 -/// Internal class to register a future instance with [lazyPut],  
414 -/// keeps a reference to the callback to be called.  
415 -class _Lazy {  
416 - bool fenix;  
417 - InstanceBuilderCallback builder;  
418 -  
419 - _Lazy(this.builder, this.fenix);  
420 -}  
1 -/// Special callable class to keep the contract of a regular method, and avoid  
2 -/// overrides if you extend the class that uses it, as Dart has no final  
3 -/// methods.  
4 -/// Used in [DisposableInterface] to avoid the danger of overriding onStart.  
5 -///  
6 -class _InternalFinalCallback<T> {  
7 - T Function() callback;  
8 -  
9 - _InternalFinalCallback();  
10 -  
11 - T call() => callback.call();  
12 -}  
13 -  
14 -abstract class GetLifeCycle {  
15 - /// Called at the exact moment the widget is allocated in memory.  
16 - /// It uses an internal "callable" type, to avoid any @overrides in subclases.  
17 - /// This method should be internal and is required to define the  
18 - /// lifetime cycle of the subclass.  
19 - final onStart = _InternalFinalCallback<void>();  
20 -  
21 - /// Called immediately after the widget is allocated in memory.  
22 - /// You might use this to initialize something for the controller.  
23 - void onInit() {}  
24 -  
25 - /// Called 1 frame after onInit(). It is the perfect place to enter  
26 - /// navigation events, like snackbar, dialogs, or a new route, or  
27 - /// async request.  
28 - void onReady() {}  
29 -  
30 - /// Called before [onDelete] method. [onClose] might be used to  
31 - /// dispose resources used by the controller. Like closing events,  
32 - /// or streams before the controller is destroyed.  
33 - /// Or dispose objects that can potentially create some memory leaks,  
34 - /// like TextEditingControllers, AnimationControllers.  
35 - /// Might be useful as well to persist some data on disk.  
36 - void onClose() {}  
37 -}  
38 -  
39 -/// Allow track difference between GetxServices and GetxControllers  
40 -mixin GetxServiceMixin {}  
1 -name: get_instance  
2 -description: A smart dependency injector to GetX™ framework.  
3 -version: 3.13.0  
4 -homepage: https://github.com/jonataslaw/getx  
5 -  
6 -environment:  
7 - sdk: ">=2.7.0 <3.0.0"  
8 -  
9 -  
10 -dependencies:  
11 - get_core: ">=3.13.0 <4.0.0"  
12 -  
13 -dev_dependencies:  
14 - test: ">=1.0.0 <2.0.0"  
15 - test_coverage: ">=0.4.3 <1.0.0"  
16 -  
17 -  
18 -# For information on the generic Dart part of this file, see the  
19 -# following page: https://dart.dev/tools/pub/pubspec  
1 -import 'package:get_instance/get_instance.dart';  
2 -import 'package:test/test.dart';  
3 -import 'package:get_core/get_core.dart';  
4 -import 'util/matcher.dart' as m;  
5 -  
6 -class Mock {  
7 - static Future<String> test() async {  
8 - await Future.delayed(Duration.zero);  
9 - return 'test';  
10 - }  
11 -}  
12 -  
13 -class Controller {}  
14 -  
15 -class DisposableController extends GetLifeCycle {  
16 - DisposableController() {  
17 - onStart.callback = _onStart;  
18 - }  
19 -  
20 - // Internal callback that starts the cycle of this controller.  
21 - void _onStart() {  
22 - onInit();  
23 - }  
24 -  
25 - bool initialized = false;  
26 -  
27 - void onInit() async {  
28 - initialized = true;  
29 - }  
30 -}  
31 -  
32 -// ignore: one_member_abstracts  
33 -abstract class Service {  
34 - String post();  
35 -}  
36 -  
37 -class Api implements Service {  
38 - @override  
39 - String post() {  
40 - return 'test';  
41 - }  
42 -}  
43 -  
44 -void main() {  
45 - test('Get.putAsync test', () async {  
46 - await Get.putAsync<String>(Mock.test);  
47 - expect('test', Get.find<String>());  
48 - Get.reset();  
49 - });  
50 -  
51 - test('Get.put test', () async {  
52 - final instance = Get.put<Controller>(Controller());  
53 - expect(instance, Get.find<Controller>());  
54 - Get.reset();  
55 - });  
56 -  
57 - test('Get.put tag test', () async {  
58 - final instance = Get.put<Controller>(Controller(), tag: 'one');  
59 - final instance2 = Get.put<Controller>(Controller(), tag: 'two');  
60 - expect(instance == instance2, false);  
61 - expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'two'),  
62 - false);  
63 - expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'one'),  
64 - true);  
65 - expect(Get.find<Controller>(tag: 'two') == Get.find<Controller>(tag: 'two'),  
66 - true);  
67 - Get.reset();  
68 - });  
69 -  
70 - test('Get.lazyPut tag test', () async {  
71 - Get.lazyPut<Controller>(() => Controller(), tag: 'one');  
72 - Get.lazyPut<Controller>(() => Controller(), tag: 'two');  
73 -  
74 - expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'two'),  
75 - false);  
76 - expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'one'),  
77 - true);  
78 - expect(Get.find<Controller>(tag: 'two') == Get.find<Controller>(tag: 'two'),  
79 - true);  
80 - Get.reset();  
81 - });  
82 -  
83 - test('Get.lazyPut test', () async {  
84 - final controller = Controller();  
85 - Get.lazyPut<Controller>(() => controller);  
86 - final ct1 = Get.find<Controller>();  
87 - expect(ct1, controller);  
88 - Get.reset();  
89 - });  
90 -  
91 - test('Get.lazyPut with abstract class test', () async {  
92 - final api = Api();  
93 - Get.lazyPut<Service>(() => api);  
94 - final ct1 = Get.find<Service>();  
95 - expect(ct1, api);  
96 - Get.reset();  
97 - });  
98 -  
99 - test('Get.create with abstract class test', () async {  
100 - Get.create<Service>(() => Api());  
101 - final ct1 = Get.find<Service>();  
102 - final ct2 = Get.find<Service>();  
103 - expect(ct1 is Service, true);  
104 - expect(ct2 is Service, true);  
105 - expect(ct1 == ct2, false);  
106 - Get.reset();  
107 - });  
108 -  
109 - group('test put, delete and check onInit execution', () {  
110 - tearDownAll(Get.reset);  
111 -  
112 - test('Get.put test with init check', () async {  
113 - final instance = Get.put<DisposableController>(DisposableController());  
114 - expect(instance, Get.find<DisposableController>());  
115 - expect(instance.initialized, true);  
116 - });  
117 -  
118 - test('Get.delete test with disposable controller', () async {  
119 - expect(await Get.delete<DisposableController>(), true);  
120 - expect(() => Get.find<DisposableController>(),  
121 - throwsA(m.TypeMatcher<String>()));  
122 - });  
123 -  
124 - test('Get.put test after delete with disposable controller and init check',  
125 - () async {  
126 - final instance = Get.put<DisposableController>(DisposableController());  
127 - expect(instance, Get.find<DisposableController>());  
128 - expect(instance.initialized, true);  
129 - });  
130 - });  
131 -}  
1 -import 'package:test/test.dart';  
2 -  
3 -// Copyright 2014, the Dart project authors. All rights reserved.  
4 -// Redistribution and use in source and binary forms, with or without  
5 -// modification, are permitted provided that the following conditions are  
6 -// met:  
7 -  
8 -// * Redistributions of source code must retain the above copyright  
9 -// notice, this list of conditions and the following disclaimer.  
10 -// * Redistributions in binary form must reproduce the above  
11 -// copyright notice, this list of conditions and the following  
12 -// disclaimer in the documentation and/or other materials provided  
13 -// with the distribution.  
14 -// * Neither the name of Google Inc. nor the names of its  
15 -// contributors may be used to endorse or promote products derived  
16 -// from this software without specific prior written permission.  
17 -  
18 -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  
19 -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  
20 -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  
21 -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  
22 -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  
23 -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  
24 -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  
25 -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  
26 -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  
27 -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  
28 -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
29 -  
30 -class _FunctionMatcher<T> extends CustomMatcher {  
31 - final dynamic Function(T value) _feature;  
32 -  
33 - _FunctionMatcher(String name, this._feature, matcher)  
34 - : super('`$name`:', '`$name`', matcher);  
35 -  
36 - @override  
37 - Object featureValueOf(covariant T actual) => _feature(actual);  
38 -}  
39 -  
40 -class HavingMatcher<T> implements TypeMatcher<T> {  
41 - final TypeMatcher<T> _parent;  
42 - final List<_FunctionMatcher<T>> _functionMatchers;  
43 -  
44 - HavingMatcher(TypeMatcher<T> parent, String description,  
45 - Object Function(T) feature, dynamic matcher,  
46 - [Iterable<_FunctionMatcher<T>> existing])  
47 - : _parent = parent,  
48 - _functionMatchers = [  
49 - ...?existing,  
50 - _FunctionMatcher<T>(description, feature, matcher)  
51 - ];  
52 -  
53 - @override  
54 - TypeMatcher<T> having(  
55 - Object Function(T) feature, String description, dynamic matcher) =>  
56 - HavingMatcher(_parent, description, feature, matcher, _functionMatchers);  
57 -  
58 - @override  
59 - bool matches(dynamic item, Map matchState) {  
60 - for (var matcher in <Matcher>[_parent].followedBy(_functionMatchers)) {  
61 - if (!matcher.matches(item, matchState)) {  
62 - addStateInfo(matchState, {'matcher': matcher});  
63 - return false;  
64 - }  
65 - }  
66 - return true;  
67 - }  
68 -  
69 - @override  
70 - Description describeMismatch(  
71 - dynamic item,  
72 - Description mismatchDescription,  
73 - Map matchState,  
74 - bool verbose,  
75 - ) {  
76 - var matcher = matchState['matcher'] as Matcher;  
77 - matcher.describeMismatch(  
78 - item, mismatchDescription, matchState['state'] as Map, verbose);  
79 - return mismatchDescription;  
80 - }  
81 -  
82 - @override  
83 - Description describe(Description description) => description  
84 - .add('')  
85 - .addDescriptionOf(_parent)  
86 - .add(' with ')  
87 - .addAll('', ' and ', '', _functionMatchers);  
88 -}  
89 -  
90 -class TypeMatcher<T> extends Matcher {  
91 - const TypeMatcher();  
92 -  
93 - TypeMatcher<T> having(  
94 - Object Function(T) feature, String description, dynamic matcher) =>  
95 - HavingMatcher(this, description, feature, matcher);  
96 -  
97 - @override  
98 - Description describe(Description description) {  
99 - var name = _stripDynamic(T);  
100 - return description.add("<Instance of '$name'>");  
101 - }  
102 -  
103 - @override  
104 - bool matches(Object item, Map matchState) => item is T;  
105 -  
106 - @override  
107 - Description describeMismatch(  
108 - dynamic item,  
109 - Description mismatchDescription,  
110 - Map matchState,  
111 - bool verbose,  
112 - ) {  
113 - var name = _stripDynamic(T);  
114 - return mismatchDescription.add("is not an instance of '$name'");  
115 - }  
116 -}  
117 -  
118 -String _stripDynamic(Type type) =>  
119 - type.toString().replaceAll(_dart2DynamicArgs, '');  
120 -final _dart2DynamicArgs = RegExp('<dynamic(, dynamic)*>');  
1 -# Miscellaneous  
2 -*.class  
3 -*.log  
4 -*.pyc  
5 -*.swp  
6 -.DS_Store  
7 -.atom/  
8 -.buildlog/  
9 -.history  
10 -.svn/  
11 -  
12 -# IntelliJ related  
13 -*.iml  
14 -*.ipr  
15 -*.iws  
16 -.idea/  
17 -  
18 -# The .vscode folder contains launch configuration and tasks you configure in  
19 -# VS Code which you may wish to be included in version control, so this line  
20 -# is commented out by default.  
21 -#.vscode/  
22 -  
23 -# Flutter/Dart/Pub related  
24 -**/doc/api/  
25 -.dart_tool/  
26 -.flutter-plugins  
27 -.flutter-plugins-dependencies  
28 -.packages  
29 -.pub-cache/  
30 -.pub/  
31 -build/  
32 -  
33 -# Android related  
34 -**/android/**/gradle-wrapper.jar  
35 -**/android/.gradle  
36 -**/android/captures/  
37 -**/android/gradlew  
38 -**/android/gradlew.bat  
39 -**/android/local.properties  
40 -**/android/**/GeneratedPluginRegistrant.java  
41 -  
42 -# iOS/XCode related  
43 -**/ios/**/*.mode1v3  
44 -**/ios/**/*.mode2v3  
45 -**/ios/**/*.moved-aside  
46 -**/ios/**/*.pbxuser  
47 -**/ios/**/*.perspectivev3  
48 -**/ios/**/*sync/  
49 -**/ios/**/.sconsign.dblite  
50 -**/ios/**/.tags*  
51 -**/ios/**/.vagrant/  
52 -**/ios/**/DerivedData/  
53 -**/ios/**/Icon?  
54 -**/ios/**/Pods/  
55 -**/ios/**/.symlinks/  
56 -**/ios/**/profile  
57 -**/ios/**/xcuserdata  
58 -**/ios/.generated/  
59 -**/ios/Flutter/App.framework  
60 -**/ios/Flutter/Flutter.framework  
61 -**/ios/Flutter/Flutter.podspec  
62 -**/ios/Flutter/Generated.xcconfig  
63 -**/ios/Flutter/app.flx  
64 -**/ios/Flutter/app.zip  
65 -**/ios/Flutter/flutter_assets/  
66 -**/ios/Flutter/flutter_export_environment.sh  
67 -**/ios/ServiceDefinitions.json  
68 -**/ios/Runner/GeneratedPluginRegistrant.*  
69 -  
70 -# Exceptions to above rules.  
71 -!**/ios/**/default.mode1v3  
72 -!**/ios/**/default.mode2v3  
73 -!**/ios/**/default.pbxuser  
74 -!**/ios/**/default.perspectivev3  
1 -# This file tracks properties of this Flutter project.  
2 -# Used by Flutter tool to assess capabilities and perform upgrades etc.  
3 -#  
4 -# This file should be version controlled and should not be manually edited.  
5 -  
6 -version:  
7 - revision: a27c242b0eea731317cfec5bbdd9d35452ab3ecb  
8 - channel: dev  
9 -  
10 -project_type: package  
1 -## [3.13.0]  
2 -* Bump to Get 3.13.0  
3 -  
4 -## [3.12.0]  
5 -* Bump to Get 3.12.0  
6 -* Fix defaultCustomTransition  
7 -  
8 -## [3.10.2]  
9 -  
10 -- initial release  
1 -MIT License  
2 -  
3 -Copyright (c) 2019 Jonny Borges  
4 -  
5 -Permission is hereby granted, free of charge, to any person obtaining a copy  
6 -of this software and associated documentation files (the "Software"), to deal  
7 -in the Software without restriction, including without limitation the rights  
8 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
9 -copies of the Software, and to permit persons to whom the Software is  
10 -furnished to do so, subject to the following conditions:  
11 -  
12 -The above copyright notice and this permission notice shall be included in all  
13 -copies or substantial portions of the Software.  
14 -  
15 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
16 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
17 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
18 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
19 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
20 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
21 -SOFTWARE.  
1 -# get_navigation  
2 -  
3 -A new Flutter package project.  
4 -  
5 -## Getting Started  
6 -  
7 -This project is a starting point for a Dart  
8 -[package](https://flutter.dev/developing-packages/),  
9 -a library module containing code that can be shared easily across  
10 -multiple Flutter or Dart projects.  
11 -  
12 -For help getting started with Flutter, view our  
13 -[online documentation](https://flutter.dev/docs), which offers tutorials,  
14 -samples, guidance on mobile development, and a full API reference.  
1 -# Include option is buggy:  
2 -# https://github.com/flutter/flutter/issues/62591  
3 -# In case the include issue gets fixed, lines below INCLUDE_FIX  
4 -# can be removed  
5 -  
6 -# include: package:effective_dart/analysis_options.1.2.0.yaml  
7 -analyzer:  
8 - strong-mode:  
9 - implicit-casts: false  
10 -linter:  
11 - rules:  
12 - await_only_futures: true  
13 - # This one is desirable, but that's a lot of work for now  
14 - public_member_api_docs: false  
15 - # Desirable, but would be breaking changes:  
16 - avoid_positional_boolean_parameters: false  
17 - constant_identifier_names: false  
18 - include_file_not_found: false  
19 -  
20 - # INCLUDE_FIX (copy of effective dart 1.2.0)  
21 - # STYLE  
22 - camel_case_types: true  
23 - camel_case_extensions: true  
24 - library_names: true  
25 - file_names: true  
26 - library_prefixes: true  
27 - non_constant_identifier_names: true  
28 - directives_ordering: true  
29 - lines_longer_than_80_chars: true # avoid  
30 - curly_braces_in_flow_control_structures: true  
31 -  
32 - # DOCUMENTATION  
33 - slash_for_doc_comments: true  
34 - package_api_docs: true # prefer  
35 - #- comment_references # Unused because https://github.com/dart-lang/sdk/issues/36974  
36 -  
37 - # USAGE  
38 - implementation_imports: true  
39 - avoid_relative_lib_imports: true # prefer  
40 - prefer_relative_imports: true # prefer  
41 - prefer_adjacent_string_concatenation: true  
42 - prefer_interpolation_to_compose_strings: true # prefer  
43 - unnecessary_brace_in_string_interps: true # avoid  
44 - prefer_collection_literals: true  
45 - avoid_function_literals_in_foreach_calls: true # avoid  
46 - prefer_iterable_whereType: true  
47 - prefer_function_declarations_over_variables: true  
48 - unnecessary_lambdas: true  
49 - prefer_equal_for_default_values: true  
50 - avoid_init_to_null: true  
51 - unnecessary_getters_setters: true  
52 - #- unnecessary_getters # prefer # Disabled pending fix: https://github.com/dart-lang/linter/issues/23  
53 - #- prefer_expression_function_bodies # consider  
54 - unnecessary_this: true  
55 - prefer_initializing_formals: true  
56 - type_init_formals: true  
57 - empty_constructor_bodies: true  
58 - unnecessary_new: true  
59 - unnecessary_const: true  
60 - avoid_catches_without_on_clauses: true # avoid  
61 - avoid_catching_errors: true  
62 - use_rethrow_when_possible: true  
63 -  
64 - # DESIGN  
65 - use_to_and_as_if_applicable: true # prefer  
66 - one_member_abstracts: true # avoid  
67 - avoid_classes_with_only_static_members: true # avoid  
68 - prefer_mixin: true  
69 - prefer_final_fields: true # prefer  
70 - use_setters_to_change_properties: true  
71 - avoid_setters_without_getters: true  
72 - avoid_returning_null: true # avoid  
73 - avoid_returning_this: true # avoid  
74 - type_annotate_public_apis: true # prefer  
75 - #- prefer_typing_uninitialized_variables # consider  
76 - omit_local_variable_types: true # avoid  
77 - avoid_types_on_closure_parameters: true # avoid  
78 - avoid_return_types_on_setters: true # avoid  
79 - prefer_generic_function_type_aliases: true  
80 - avoid_private_typedef_functions: true # prefer  
81 - #- use_function_type_syntax_for_parameters # consider  
82 - hash_and_equals: true  
83 - avoid_equals_and_hash_code_on_mutable_classes: true # avoid  
84 - avoid_null_checks_in_equality_operators: true  
85 -  
1 -library get_navigation;  
2 -  
3 -export 'package:get_core/get_core.dart';  
4 -export 'src/bottomsheet/bottomsheet.dart';  
5 -export 'src/extension_navigation.dart';  
6 -export 'src/root/root_widget.dart';  
7 -export 'src/routes/custom_transition.dart';  
8 -export 'src/routes/default_route.dart';  
9 -export 'src/routes/default_route.dart';  
10 -export 'src/routes/get_route.dart';  
11 -export 'src/routes/observers/route_observer.dart';  
12 -export 'src/routes/transitions_type.dart';  
13 -export 'src/snackbar/snack.dart';  
14 -export 'src/snackbar/snack_route.dart';  
1 -import 'package:flutter/material.dart';  
2 -  
3 -class GetModalBottomSheetRoute<T> extends PopupRoute<T> {  
4 - GetModalBottomSheetRoute({  
5 - this.builder,  
6 - this.theme,  
7 - this.barrierLabel,  
8 - this.backgroundColor,  
9 - this.isPersistent,  
10 - this.elevation,  
11 - this.shape,  
12 - this.removeTop = true,  
13 - this.clipBehavior,  
14 - this.modalBarrierColor,  
15 - this.isDismissible = true,  
16 - this.enableDrag = true,  
17 - @required this.isScrollControlled,  
18 - RouteSettings settings,  
19 - this.enterBottomSheetDuration = const Duration(milliseconds: 250),  
20 - this.exitBottomSheetDuration = const Duration(milliseconds: 200),  
21 - }) : assert(isScrollControlled != null),  
22 - name = "BOTTOMSHEET: ${builder.hashCode}",  
23 - assert(isDismissible != null),  
24 - assert(enableDrag != null),  
25 - super(settings: settings);  
26 - final bool isPersistent;  
27 - final WidgetBuilder builder;  
28 - final ThemeData theme;  
29 - final bool isScrollControlled;  
30 - final Color backgroundColor;  
31 - final double elevation;  
32 - final ShapeBorder shape;  
33 - final Clip clipBehavior;  
34 - final Color modalBarrierColor;  
35 - final bool isDismissible;  
36 - final bool enableDrag;  
37 - final String name;  
38 - final Duration enterBottomSheetDuration;  
39 - final Duration exitBottomSheetDuration;  
40 - // remove safearea from top  
41 - final bool removeTop;  
42 -  
43 - @override  
44 - Duration get transitionDuration => Duration(milliseconds: 700);  
45 -  
46 - @override  
47 - bool get barrierDismissible => isDismissible;  
48 -  
49 - @override  
50 - final String barrierLabel;  
51 -  
52 - @override  
53 - Color get barrierColor => modalBarrierColor ?? Colors.black54;  
54 -  
55 - AnimationController _animationController;  
56 -  
57 - @override  
58 - AnimationController createAnimationController() {  
59 - assert(_animationController == null);  
60 - _animationController =  
61 - BottomSheet.createAnimationController(navigator.overlay);  
62 - _animationController.duration = enterBottomSheetDuration;  
63 - _animationController.reverseDuration = exitBottomSheetDuration;  
64 - return _animationController;  
65 - }  
66 -  
67 - @override  
68 - Widget buildPage(BuildContext context, Animation<double> animation,  
69 - Animation<double> secondaryAnimation) {  
70 - final sheetTheme =  
71 - theme?.bottomSheetTheme ?? Theme.of(context).bottomSheetTheme;  
72 - // By definition, the bottom sheet is aligned to the bottom of the page  
73 - // and isn't exposed to the top padding of the MediaQuery.  
74 - Widget bottomSheet = MediaQuery.removePadding(  
75 - context: context,  
76 - removeTop: removeTop,  
77 - child: Padding(  
78 - padding:  
79 - EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),  
80 - child: _GetModalBottomSheet<T>(  
81 - route: this,  
82 - backgroundColor: backgroundColor ??  
83 - sheetTheme?.modalBackgroundColor ??  
84 - sheetTheme?.backgroundColor,  
85 - elevation:  
86 - elevation ?? sheetTheme?.modalElevation ?? sheetTheme?.elevation,  
87 - shape: shape,  
88 - clipBehavior: clipBehavior,  
89 - isScrollControlled: isScrollControlled,  
90 - enableDrag: enableDrag,  
91 - ),  
92 - ),  
93 - );  
94 - if (theme != null) bottomSheet = Theme(data: theme, child: bottomSheet);  
95 - return bottomSheet;  
96 - }  
97 -}  
98 -  
99 -class _GetModalBottomSheet<T> extends StatefulWidget {  
100 - const _GetModalBottomSheet({  
101 - Key key,  
102 - this.route,  
103 - this.backgroundColor,  
104 - this.elevation,  
105 - this.shape,  
106 - this.clipBehavior,  
107 - this.isScrollControlled = false,  
108 - this.enableDrag = true,  
109 - this.isPersistent = false,  
110 - }) : assert(isScrollControlled != null),  
111 - assert(enableDrag != null),  
112 - super(key: key);  
113 - final bool isPersistent;  
114 - final GetModalBottomSheetRoute<T> route;  
115 - final bool isScrollControlled;  
116 - final Color backgroundColor;  
117 - final double elevation;  
118 - final ShapeBorder shape;  
119 - final Clip clipBehavior;  
120 - final bool enableDrag;  
121 -  
122 - @override  
123 - _GetModalBottomSheetState<T> createState() => _GetModalBottomSheetState<T>();  
124 -}  
125 -  
126 -class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {  
127 - String _getRouteLabel(MaterialLocalizations localizations) {  
128 - if ((Theme.of(context).platform == TargetPlatform.android) ||  
129 - (Theme.of(context).platform == TargetPlatform.fuchsia)) {  
130 - return localizations.dialogLabel;  
131 - } else {  
132 - return '';  
133 - }  
134 - }  
135 -  
136 - @override  
137 - Widget build(BuildContext context) {  
138 - assert(debugCheckHasMediaQuery(context));  
139 - assert(debugCheckHasMaterialLocalizations(context));  
140 - final mediaQuery = MediaQuery.of(context);  
141 - final localizations = MaterialLocalizations.of(context);  
142 - final routeLabel = _getRouteLabel(localizations);  
143 -  
144 - return AnimatedBuilder(  
145 - animation: widget.route.animation,  
146 - builder: (context, child) {  
147 - // Disable the initial animation when accessible navigation is on so  
148 - // that the semantics are added to the tree at the correct time.  
149 - final animationValue = mediaQuery.accessibleNavigation  
150 - ? 1.0  
151 - : widget.route.animation.value;  
152 - return Semantics(  
153 - scopesRoute: true,  
154 - namesRoute: true,  
155 - label: routeLabel,  
156 - explicitChildNodes: true,  
157 - child: ClipRect(  
158 - child: CustomSingleChildLayout(  
159 - delegate: _GetModalBottomSheetLayout(  
160 - animationValue, widget.isScrollControlled),  
161 - child: widget.isPersistent == false  
162 - ? BottomSheet(  
163 - animationController: widget.route._animationController,  
164 - onClosing: () {  
165 - if (widget.route.isCurrent) {  
166 - Navigator.pop(context);  
167 - }  
168 - },  
169 - builder: widget.route.builder,  
170 - backgroundColor: widget.backgroundColor,  
171 - elevation: widget.elevation,  
172 - shape: widget.shape,  
173 - clipBehavior: widget.clipBehavior,  
174 - enableDrag: widget.enableDrag,  
175 - )  
176 - : Scaffold(  
177 - bottomSheet: BottomSheet(  
178 - animationController:  
179 - widget.route._animationController,  
180 - onClosing: () {  
181 - // if (widget.route.isCurrent) {  
182 - // Navigator.pop(context);  
183 - // }  
184 - },  
185 - builder: widget.route.builder,  
186 - backgroundColor: widget.backgroundColor,  
187 - elevation: widget.elevation,  
188 - shape: widget.shape,  
189 - clipBehavior: widget.clipBehavior,  
190 - enableDrag: widget.enableDrag,  
191 - ),  
192 - )),  
193 - ),  
194 - );  
195 - },  
196 - );  
197 - }  
198 -}  
199 -  
200 -class _GetPerModalBottomSheet<T> extends StatefulWidget {  
201 - const _GetPerModalBottomSheet({  
202 - Key key,  
203 - this.route,  
204 - this.isPersistent,  
205 - this.backgroundColor,  
206 - this.elevation,  
207 - this.shape,  
208 - this.clipBehavior,  
209 - this.isScrollControlled = false,  
210 - this.enableDrag = true,  
211 - }) : assert(isScrollControlled != null),  
212 - assert(enableDrag != null),  
213 - super(key: key);  
214 - final bool isPersistent;  
215 - final GetModalBottomSheetRoute<T> route;  
216 - final bool isScrollControlled;  
217 - final Color backgroundColor;  
218 - final double elevation;  
219 - final ShapeBorder shape;  
220 - final Clip clipBehavior;  
221 - final bool enableDrag;  
222 -  
223 - @override  
224 - // ignore: lines_longer_than_80_chars  
225 - _GetPerModalBottomSheetState<T> createState() =>  
226 - _GetPerModalBottomSheetState<T>();  
227 -}  
228 -  
229 -// ignore: lines_longer_than_80_chars  
230 -class _GetPerModalBottomSheetState<T>  
231 - extends State<_GetPerModalBottomSheet<T>> {  
232 - String _getRouteLabel(MaterialLocalizations localizations) {  
233 - if ((Theme.of(context).platform == TargetPlatform.android) ||  
234 - (Theme.of(context).platform == TargetPlatform.fuchsia)) {  
235 - return localizations.dialogLabel;  
236 - } else {  
237 - return '';  
238 - }  
239 - }  
240 -  
241 - @override  
242 - Widget build(BuildContext context) {  
243 - assert(debugCheckHasMediaQuery(context));  
244 - assert(debugCheckHasMaterialLocalizations(context));  
245 - final mediaQuery = MediaQuery.of(context);  
246 - final localizations = MaterialLocalizations.of(context);  
247 - final routeLabel = _getRouteLabel(localizations);  
248 -  
249 - return AnimatedBuilder(  
250 - animation: widget.route.animation,  
251 - builder: (context, child) {  
252 - // Disable the initial animation when accessible navigation is on so  
253 - // that the semantics are added to the tree at the correct time.  
254 - final animationValue = mediaQuery.accessibleNavigation  
255 - ? 1.0  
256 - : widget.route.animation.value;  
257 - return Semantics(  
258 - scopesRoute: true,  
259 - namesRoute: true,  
260 - label: routeLabel,  
261 - explicitChildNodes: true,  
262 - child: ClipRect(  
263 - child: CustomSingleChildLayout(  
264 - delegate: _GetModalBottomSheetLayout(  
265 - animationValue, widget.isScrollControlled),  
266 - child: widget.isPersistent == false  
267 - ? BottomSheet(  
268 - animationController: widget.route._animationController,  
269 - onClosing: () {  
270 - if (widget.route.isCurrent) {  
271 - Navigator.pop(context);  
272 - }  
273 - },  
274 - builder: widget.route.builder,  
275 - backgroundColor: widget.backgroundColor,  
276 - elevation: widget.elevation,  
277 - shape: widget.shape,  
278 - clipBehavior: widget.clipBehavior,  
279 - enableDrag: widget.enableDrag,  
280 - )  
281 - : Scaffold(  
282 - bottomSheet: BottomSheet(  
283 - animationController:  
284 - widget.route._animationController,  
285 - onClosing: () {  
286 - // if (widget.route.isCurrent) {  
287 - // Navigator.pop(context);  
288 - // }  
289 - },  
290 - builder: widget.route.builder,  
291 - backgroundColor: widget.backgroundColor,  
292 - elevation: widget.elevation,  
293 - shape: widget.shape,  
294 - clipBehavior: widget.clipBehavior,  
295 - enableDrag: widget.enableDrag,  
296 - ),  
297 - )),  
298 - ),  
299 - );  
300 - },  
301 - );  
302 - }  
303 -}  
304 -  
305 -class _GetModalBottomSheetLayout extends SingleChildLayoutDelegate {  
306 - _GetModalBottomSheetLayout(this.progress, this.isScrollControlled);  
307 -  
308 - final double progress;  
309 - final bool isScrollControlled;  
310 -  
311 - @override  
312 - BoxConstraints getConstraintsForChild(BoxConstraints constraints) {  
313 - return BoxConstraints(  
314 - minWidth: constraints.maxWidth,  
315 - maxWidth: constraints.maxWidth,  
316 - minHeight: 0.0,  
317 - maxHeight: isScrollControlled  
318 - ? constraints.maxHeight  
319 - : constraints.maxHeight * 9.0 / 16.0,  
320 - );  
321 - }  
322 -  
323 - @override  
324 - Offset getPositionForChild(Size size, Size childSize) {  
325 - return Offset(0.0, size.height - childSize.height * progress);  
326 - }  
327 -  
328 - @override  
329 - bool shouldRelayout(_GetModalBottomSheetLayout oldDelegate) {  
330 - return progress != oldDelegate.progress;  
331 - }  
332 -}  
1 -import 'package:flutter/widgets.dart';  
2 -import 'package:get_core/get_core.dart';  
3 -import 'package:get_state_manager/get_state_manager.dart';  
4 -  
5 -class GetDialogRoute<T> extends PopupRoute<T> {  
6 - GetDialogRoute({  
7 - @required RoutePageBuilder pageBuilder,  
8 - bool barrierDismissible = true,  
9 - String barrierLabel,  
10 - Color barrierColor = const Color(0x80000000),  
11 - Duration transitionDuration = const Duration(milliseconds: 200),  
12 - RouteTransitionsBuilder transitionBuilder,  
13 - RouteSettings settings,  
14 - }) : assert(barrierDismissible != null),  
15 - widget = pageBuilder,  
16 - name = "DIALOG: ${pageBuilder.hashCode}",  
17 - _barrierDismissible = barrierDismissible,  
18 - _barrierLabel = barrierLabel,  
19 - _barrierColor = barrierColor,  
20 - _transitionDuration = transitionDuration,  
21 - _transitionBuilder = transitionBuilder,  
22 - super(settings: settings);  
23 -  
24 - final RoutePageBuilder widget;  
25 -  
26 - @override  
27 - bool get barrierDismissible => _barrierDismissible;  
28 - final bool _barrierDismissible;  
29 -  
30 - final String name;  
31 -  
32 - @override  
33 - void dispose() {  
34 - if (Get.smartManagement != SmartManagement.onlyBuilder) {  
35 - WidgetsBinding.instance.addPostFrameCallback(  
36 - (_) => GetInstance().removeDependencyByRoute(name));  
37 - }  
38 - super.dispose();  
39 - }  
40 -  
41 - @override  
42 - String get barrierLabel => _barrierLabel;  
43 - final String _barrierLabel;  
44 -  
45 - @override  
46 - Color get barrierColor => _barrierColor;  
47 - final Color _barrierColor;  
48 -  
49 - @override  
50 - Duration get transitionDuration => _transitionDuration;  
51 - final Duration _transitionDuration;  
52 -  
53 - final RouteTransitionsBuilder _transitionBuilder;  
54 -  
55 - @override  
56 - Widget buildPage(BuildContext context, Animation<double> animation,  
57 - Animation<double> secondaryAnimation) {  
58 - return Semantics(  
59 - child: widget(context, animation, secondaryAnimation),  
60 - scopesRoute: true,  
61 - explicitChildNodes: true,  
62 - );  
63 - }  
64 -  
65 - @override  
66 - Widget buildTransitions(BuildContext context, Animation<double> animation,  
67 - Animation<double> secondaryAnimation, Widget child) {  
68 - if (_transitionBuilder == null) {  
69 - return FadeTransition(  
70 - opacity: CurvedAnimation(  
71 - parent: animation,  
72 - curve: Curves.linear,  
73 - ),  
74 - child: child);  
75 - } // Some default transition  
76 - return _transitionBuilder(context, animation, secondaryAnimation, child);  
77 - }  
78 -}  
1 -import 'package:flutter/material.dart';  
2 -import 'package:flutter/scheduler.dart';  
3 -import 'package:get_core/get_core.dart';  
4 -import 'package:get_state_manager/get_state_manager.dart';  
5 -import 'package:get_utils/get_utils.dart';  
6 -import '../get_navigation.dart';  
7 -import 'dialog/dialog_route.dart';  
8 -import 'root/parse_route.dart';  
9 -import 'root/root_controller.dart';  
10 -import 'routes/transitions_type.dart';  
11 -  
12 -//TODO: Split this class on "Snackbar" "Dialog" "bottomSheet"  
13 -//and "navigation" extensions  
14 -extension GetNavigation on GetInterface {  
15 - /// **Navigation.push()** shortcut.<br><br>  
16 - ///  
17 - /// Pushes a new [page] to the stack  
18 - ///  
19 - /// It has the advantage of not needing context,  
20 - /// so you can call from your business logic  
21 - ///  
22 - /// You can set a custom [transition], and a transition [duration].  
23 - ///  
24 - /// You can send any type of value to the other route in the [arguments].  
25 - ///  
26 - /// Just like native routing in Flutter, you can push a route  
27 - /// as a [fullscreenDialog],  
28 - ///  
29 - /// [id] is for when you are using nested navigation,  
30 - /// as explained in documentation  
31 - ///  
32 - /// If you want the same behavior of ios that pops a route when the user drag,  
33 - /// you can set [popGesture] to true  
34 - ///  
35 - /// If you're using the [Bindings] api, you must define it here  
36 - ///  
37 - /// By default, GetX will prevent you from push a route that you already in,  
38 - /// if you want to push anyway, set [preventDuplicates] to false  
39 - Future<T> to<T>(  
40 - Widget page, {  
41 - bool opaque,  
42 - Transition transition,  
43 - Curve curve,  
44 - Duration duration,  
45 - int id,  
46 - bool fullscreenDialog = false,  
47 - dynamic arguments,  
48 - Bindings binding,  
49 - bool preventDuplicates = true,  
50 - bool popGesture,  
51 - }) {  
52 - var routeName = "/${page.runtimeType.toString()}";  
53 - if (preventDuplicates && routeName == currentRoute) {  
54 - return null;  
55 - }  
56 - return global(id)?.currentState?.push(  
57 - GetPageRoute(  
58 - opaque: opaque ?? true,  
59 - page: () => page,  
60 - routeName: routeName,  
61 - settings: RouteSettings(  
62 - // name: forceRouteName ? '${a.runtimeType}' : '',  
63 - arguments: arguments,  
64 - ),  
65 - popGesture: popGesture ?? defaultPopGesture,  
66 - transition: transition ?? defaultTransition,  
67 - curve: curve ?? defaultTransitionCurve,  
68 - fullscreenDialog: fullscreenDialog,  
69 - binding: binding,  
70 - transitionDuration: duration ?? defaultTransitionDuration,  
71 - ),  
72 - );  
73 - }  
74 -  
75 - /// **Navigation.pushNamed()** shortcut.<br><br>  
76 - ///  
77 - /// Pushes a new named [page] to the stack.  
78 - ///  
79 - /// It has the advantage of not needing context, so you can call  
80 - /// from your business logic.  
81 - ///  
82 - /// You can send any type of value to the other route in the [arguments].  
83 - ///  
84 - /// [id] is for when you are using nested navigation,  
85 - /// as explained in documentation  
86 - ///  
87 - /// By default, GetX will prevent you from push a route that you already in,  
88 - /// if you want to push anyway, set [preventDuplicates] to false  
89 - ///  
90 - /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors  
91 - Future<T> toNamed<T>(  
92 - String page, {  
93 - dynamic arguments,  
94 - int id,  
95 - bool preventDuplicates = true,  
96 - }) {  
97 - if (preventDuplicates && page == currentRoute) {  
98 - return null;  
99 - }  
100 - return global(id)?.currentState?.pushNamed(page, arguments: arguments);  
101 - }  
102 -  
103 - /// **Navigation.pushReplacementNamed()** shortcut.<br><br>  
104 - ///  
105 - /// Pop the current named [page] in the stack and push a new one in its place  
106 - ///  
107 - /// It has the advantage of not needing context, so you can call  
108 - /// from your business logic.  
109 - ///  
110 - /// You can send any type of value to the other route in the [arguments].  
111 - ///  
112 - /// [id] is for when you are using nested navigation,  
113 - /// as explained in documentation  
114 - ///  
115 - /// By default, GetX will prevent you from push a route that you already in,  
116 - /// if you want to push anyway, set [preventDuplicates] to false  
117 - ///  
118 - /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors  
119 - Future<T> offNamed<T>(  
120 - String page, {  
121 - dynamic arguments,  
122 - int id,  
123 - bool preventDuplicates = true,  
124 - }) {  
125 - if (preventDuplicates && page == currentRoute) {  
126 - return null;  
127 - }  
128 - return global(id)  
129 - ?.currentState  
130 - ?.pushReplacementNamed(page, arguments: arguments);  
131 - }  
132 -  
133 - /// **Navigation.popUntil()** shortcut.<br><br>  
134 - ///  
135 - /// Calls pop several times in the stack until [predicate] returns true  
136 - ///  
137 - /// [id] is for when you are using nested navigation,  
138 - /// as explained in documentation  
139 - ///  
140 - /// [predicate] can be used like this:  
141 - /// `Get.until((route) => Get.currentRoute == '/home')`so when you get to home page,  
142 - ///  
143 - /// or also like this:  
144 - /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the  
145 - /// dialog is closed  
146 - void until(RoutePredicate predicate, {int id}) {  
147 - // if (key.currentState.mounted) // add this if appear problems on future with route navigate  
148 - // when widget don't mounted  
149 - return global(id)?.currentState?.popUntil(predicate);  
150 - }  
151 -  
152 - /// **Navigation.pushAndRemoveUntil()** shortcut.<br><br>  
153 - ///  
154 - /// Push the given [page], and then pop several pages in the stack until  
155 - /// [predicate] returns true  
156 - ///  
157 - /// [id] is for when you are using nested navigation,  
158 - /// as explained in documentation  
159 - ///  
160 - /// Obs: unlike other get methods, this one you need to send a function  
161 - /// that returns the widget to the page argument, like this:  
162 - /// Get.offUntil( () => HomePage() )  
163 - ///  
164 - /// [predicate] can be used like this:  
165 - /// `Get.until((route) => Get.currentRoute == '/home')`so when you get to home page,  
166 - ///  
167 - /// or also like this:  
168 - /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog  
169 - /// is closed  
170 - Future<T> offUntil<T>(Route<T> page, RoutePredicate predicate, {int id}) {  
171 - // if (key.currentState.mounted) // add this if appear problems on future with route navigate  
172 - // when widget don't mounted  
173 - return global(id)?.currentState?.pushAndRemoveUntil(page, predicate);  
174 - }  
175 -  
176 - /// **Navigation.pushNamedAndRemoveUntil()** shortcut.<br><br>  
177 - ///  
178 - /// Push the given named [page], and then pop several pages in the stack  
179 - /// until [predicate] returns true  
180 - ///  
181 - /// You can send any type of value to the other route in the [arguments].  
182 - ///  
183 - /// [id] is for when you are using nested navigation,  
184 - /// as explained in documentation  
185 - ///  
186 - /// [predicate] can be used like this:  
187 - /// `Get.until((route) => Get.currentRoute == '/home')`so when you get to home page,  
188 - /// or also like  
189 - /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog  
190 - /// is closed  
191 - ///  
192 - /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors  
193 - Future<T> offNamedUntil<T>(  
194 - String page,  
195 - RoutePredicate predicate, {  
196 - int id,  
197 - dynamic arguments,  
198 - }) {  
199 - return global(id)  
200 - ?.currentState  
201 - ?.pushNamedAndRemoveUntil(page, predicate, arguments: arguments);  
202 - }  
203 -  
204 - /// **Navigation.popAndPushNamed()** shortcut.<br><br>  
205 - ///  
206 - /// Pop the current named page and pushes a new [page] to the stack  
207 - /// in its place  
208 - ///  
209 - /// You can send any type of value to the other route in the [arguments].  
210 - /// It is very similar to `offNamed()` but use a different approach  
211 - ///  
212 - /// The `offNamed()` pop a page, and goes to the next. The  
213 - /// `offAndToNamed()` goes to the next page, and removes the previous one.  
214 - /// The route transition animation is different.  
215 - Future<T> offAndToNamed<T>(  
216 - String page, {  
217 - dynamic arguments,  
218 - int id,  
219 - dynamic result,  
220 - }) {  
221 - return global(id)  
222 - ?.currentState  
223 - ?.popAndPushNamed(page, arguments: arguments, result: result);  
224 - }  
225 -  
226 - /// **Navigation.removeRoute()** shortcut.<br><br>  
227 - ///  
228 - /// Remove a specific [route] from the stack  
229 - ///  
230 - /// [id] is for when you are using nested navigation,  
231 - /// as explained in documentation  
232 - void removeRoute(Route<dynamic> route, {int id}) {  
233 - return global(id)?.currentState?.removeRoute(route);  
234 - }  
235 -  
236 - /// **Navigation.pushNamedAndRemoveUntil()** shortcut.<br><br>  
237 - ///  
238 - /// Push a named [page] and pop several pages in the stack  
239 - /// until [predicate] returns true. [predicate] is optional  
240 - ///  
241 - /// It has the advantage of not needing context, so you can  
242 - /// call from your business logic.  
243 - ///  
244 - /// You can send any type of value to the other route in the [arguments].  
245 - ///  
246 - /// [predicate] can be used like this:  
247 - /// `Get.until((route) => Get.currentRoute == '/home')`so when you get to home page,  
248 - /// or also like  
249 - /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog  
250 - /// is closed  
251 - ///  
252 - /// [id] is for when you are using nested navigation,  
253 - /// as explained in documentation  
254 - ///  
255 - /// Note: Always put a slash on the route ('/page1'), to avoid unexpected errors  
256 - Future<T> offAllNamed<T>(  
257 - String newRouteName, {  
258 - RoutePredicate predicate,  
259 - dynamic arguments,  
260 - int id,  
261 - }) {  
262 - return global(id)?.currentState?.pushNamedAndRemoveUntil(  
263 - newRouteName,  
264 - predicate ?? (_) => false,  
265 - arguments: arguments,  
266 - );  
267 - }  
268 -  
269 - /// Returns true if a Snackbar, Dialog or BottomSheet is currently OPEN  
270 - bool get isOverlaysOpen =>  
271 - (isSnackbarOpen || isDialogOpen || isBottomSheetOpen);  
272 -  
273 - /// Returns true if there is no Snackbar, Dialog or BottomSheet open  
274 - bool get isOverlaysClosed =>  
275 - (!isSnackbarOpen && !isDialogOpen && !isBottomSheetOpen);  
276 -  
277 - /// **Navigation.popUntil()** shortcut.<br><br>  
278 - ///  
279 - /// Pop the current page, snackbar, dialog or bottomsheet in the stack  
280 - ///  
281 - /// if your set [closeOverlays] to true, Get.back() will close the  
282 - /// currently open snackbar/dialog/bottomsheet AND the current page  
283 - ///  
284 - /// [id] is for when you are using nested navigation,  
285 - /// as explained in documentation  
286 - ///  
287 - /// It has the advantage of not needing context, so you can call  
288 - /// from your business logic.  
289 - void back({  
290 - dynamic result,  
291 - bool closeOverlays = false,  
292 - bool canPop = true,  
293 - int id,  
294 - }) {  
295 - if (closeOverlays && isOverlaysOpen) {  
296 - navigator?.popUntil((route) {  
297 - return (isOverlaysClosed);  
298 - });  
299 - }  
300 - if (canPop) {  
301 - if (global(id)?.currentState?.canPop() == true) {  
302 - global(id)?.currentState?.pop(result);  
303 - }  
304 - } else {  
305 - global(id)?.currentState?.pop(result);  
306 - }  
307 - }  
308 -  
309 - /// **Navigation.popUntil()** (with predicate) shortcut .<br><br>  
310 - ///  
311 - /// Close as many routes as defined by [times]  
312 - ///  
313 - /// [id] is for when you are using nested navigation,  
314 - /// as explained in documentation  
315 - void close(int times, [int id]) {  
316 - if ((times == null) || (times < 1)) {  
317 - times = 1;  
318 - }  
319 - var count = 0;  
320 - var back = global(id)?.currentState?.popUntil((route) => count++ == times);  
321 -  
322 - return back;  
323 - }  
324 -  
325 - /// **Navigation.pushReplacement()** shortcut .<br><br>  
326 - ///  
327 - /// Pop the current page and pushes a new [page] to the stack  
328 - ///  
329 - /// It has the advantage of not needing context,  
330 - /// so you can call from your business logic  
331 - ///  
332 - /// You can set a custom [transition], define a Tween [curve],  
333 - /// and a transition [duration].  
334 - ///  
335 - /// You can send any type of value to the other route in the [arguments].  
336 - ///  
337 - /// Just like native routing in Flutter, you can push a route  
338 - /// as a [fullscreenDialog],  
339 - ///  
340 - /// [id] is for when you are using nested navigation,  
341 - /// as explained in documentation  
342 - ///  
343 - /// If you want the same behavior of ios that pops a route when the user drag,  
344 - /// you can set [popGesture] to true  
345 - ///  
346 - /// If you're using the [Bindings] api, you must define it here  
347 - ///  
348 - /// By default, GetX will prevent you from push a route that you already in,  
349 - /// if you want to push anyway, set [preventDuplicates] to false  
350 - Future<T> off<T>(  
351 - Widget page, {  
352 - bool opaque = false,  
353 - Transition transition,  
354 - Curve curve,  
355 - bool popGesture,  
356 - int id,  
357 - dynamic arguments,  
358 - Bindings binding,  
359 - bool fullscreenDialog = false,  
360 - bool preventDuplicates = true,  
361 - Duration duration,  
362 - }) {  
363 - var routeName = "/${page.runtimeType.toString()}";  
364 - if (preventDuplicates && routeName == currentRoute) {  
365 - return null;  
366 - }  
367 - return global(id)?.currentState?.pushReplacement(GetPageRoute(  
368 - opaque: opaque ?? true,  
369 - page: () => page,  
370 - binding: binding,  
371 - settings: RouteSettings(arguments: arguments),  
372 - routeName: routeName,  
373 - fullscreenDialog: fullscreenDialog,  
374 - popGesture: popGesture ?? defaultPopGesture,  
375 - transition: transition ?? defaultTransition,  
376 - curve: curve ?? defaultTransitionCurve,  
377 - transitionDuration: duration ?? defaultTransitionDuration));  
378 - }  
379 -  
380 - /// **Navigation.pushAndRemoveUntil()** shortcut .<br><br>  
381 - ///  
382 - /// Push a [page] and pop several pages in the stack  
383 - /// until [predicate] returns true. [predicate] is optional  
384 - ///  
385 - /// It has the advantage of not needing context,  
386 - /// so you can call from your business logic  
387 - ///  
388 - /// You can set a custom [transition], a [curve] and a transition [duration].  
389 - ///  
390 - /// You can send any type of value to the other route in the [arguments].  
391 - ///  
392 - /// Just like native routing in Flutter, you can push a route  
393 - /// as a [fullscreenDialog],  
394 - ///  
395 - /// [predicate] can be used like this:  
396 - /// `Get.until((route) => Get.currentRoute == '/home')`so when you get to home page,  
397 - /// or also like  
398 - /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog  
399 - /// is closed  
400 - ///  
401 - /// [id] is for when you are using nested navigation,  
402 - /// as explained in documentation  
403 - ///  
404 - /// If you want the same behavior of ios that pops a route when the user drag,  
405 - /// you can set [popGesture] to true  
406 - ///  
407 - /// If you're using the [Bindings] api, you must define it here  
408 - ///  
409 - /// By default, GetX will prevent you from push a route that you already in,  
410 - /// if you want to push anyway, set [preventDuplicates] to false  
411 - Future<T> offAll<T>(  
412 - Widget page, {  
413 - RoutePredicate predicate,  
414 - bool opaque = false,  
415 - bool popGesture,  
416 - int id,  
417 - dynamic arguments,  
418 - Bindings binding,  
419 - bool fullscreenDialog = false,  
420 - Transition transition,  
421 - Curve curve,  
422 - Duration duration,  
423 - }) {  
424 - var routeName = "/${page.runtimeType.toString()}";  
425 -  
426 - return global(id)?.currentState?.pushAndRemoveUntil(  
427 - GetPageRoute(  
428 - opaque: opaque ?? true,  
429 - popGesture: popGesture ?? defaultPopGesture,  
430 - page: () => page,  
431 - binding: binding,  
432 - settings: RouteSettings(arguments: arguments),  
433 - fullscreenDialog: fullscreenDialog,  
434 - routeName: routeName,  
435 - transition: transition ?? defaultTransition,  
436 - curve: curve ?? defaultTransitionCurve,  
437 - transitionDuration: duration ?? defaultTransitionDuration,  
438 - ),  
439 - predicate ?? (route) => false);  
440 - }  
441 -  
442 - /// Show a dialog.  
443 - /// You can pass a [transitionDuration] and/or [transitionCurve],  
444 - /// overriding the defaults when the dialog shows up and closes.  
445 - /// When the dialog closes, uses those animations in reverse.  
446 - Future<T> dialog<T>(  
447 - Widget widget, {  
448 - bool barrierDismissible = true,  
449 - Color barrierColor,  
450 - bool useSafeArea = true,  
451 - bool useRootNavigator = true,  
452 - RouteSettings routeSettings,  
453 - Duration transitionDuration,  
454 - Curve transitionCurve,  
455 - }) {  
456 - assert(widget != null);  
457 - assert(barrierDismissible != null);  
458 - assert(useSafeArea != null);  
459 - assert(useRootNavigator != null);  
460 - assert(debugCheckHasMaterialLocalizations(context));  
461 -  
462 - final theme = Theme.of(context, shadowThemeOnly: true);  
463 - return generalDialog(  
464 - pageBuilder: (buildContext, animation, secondaryAnimation) {  
465 - final pageChild = widget;  
466 - Widget dialog = Builder(builder: (context) {  
467 - return theme != null  
468 - ? Theme(data: theme, child: pageChild)  
469 - : pageChild;  
470 - });  
471 - if (useSafeArea) {  
472 - dialog = SafeArea(child: dialog);  
473 - }  
474 - return dialog;  
475 - },  
476 - barrierDismissible: barrierDismissible,  
477 - barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,  
478 - barrierColor: barrierColor ?? Colors.black54,  
479 - transitionDuration: transitionDuration ?? defaultDialogTransitionDuration,  
480 - transitionBuilder: (context, animation, secondaryAnimation, child) {  
481 - return FadeTransition(  
482 - opacity: CurvedAnimation(  
483 - parent: animation,  
484 - curve: transitionCurve ?? defaultDialogTransitionCurve,  
485 - ),  
486 - child: child,  
487 - );  
488 - },  
489 - useRootNavigator: useRootNavigator,  
490 - routeSettings: routeSettings,  
491 - );  
492 - }  
493 -  
494 - /// Api from showGeneralDialog with no context  
495 - Future<T> generalDialog<T>({  
496 - @required RoutePageBuilder pageBuilder,  
497 - bool barrierDismissible = false,  
498 - String barrierLabel,  
499 - Color barrierColor = const Color(0x80000000),  
500 - Duration transitionDuration = const Duration(milliseconds: 200),  
501 - RouteTransitionsBuilder transitionBuilder,  
502 - bool useRootNavigator = true,  
503 - RouteSettings routeSettings,  
504 - }) {  
505 - assert(pageBuilder != null);  
506 - assert(useRootNavigator != null);  
507 - assert(!barrierDismissible || barrierLabel != null);  
508 - return Navigator.of(overlayContext, rootNavigator: useRootNavigator)  
509 - .push<T>(GetDialogRoute<T>(  
510 - pageBuilder: pageBuilder,  
511 - barrierDismissible: barrierDismissible,  
512 - barrierLabel: barrierLabel,  
513 - barrierColor: barrierColor,  
514 - transitionDuration: transitionDuration,  
515 - transitionBuilder: transitionBuilder,  
516 - settings: routeSettings,  
517 - ));  
518 - }  
519 -  
520 - /// Custom UI Dialog.  
521 - Future<T> defaultDialog<T>({  
522 - String title = "Alert",  
523 - TextStyle titleStyle,  
524 - Widget content,  
525 - VoidCallback onConfirm,  
526 - VoidCallback onCancel,  
527 - VoidCallback onCustom,  
528 - Color cancelTextColor,  
529 - Color confirmTextColor,  
530 - String textConfirm,  
531 - String textCancel,  
532 - String textCustom,  
533 - Widget confirm,  
534 - Widget cancel,  
535 - Widget custom,  
536 - Color backgroundColor,  
537 - bool barrierDismissible = true,  
538 - Color buttonColor,  
539 - String middleText = "Dialog made in 3 lines of code",  
540 - TextStyle middleTextStyle,  
541 - double radius = 20.0,  
542 - // ThemeData themeData,  
543 - List<Widget> actions,  
544 - }) {  
545 - var leanCancel = onCancel != null || textCancel != null;  
546 - var leanConfirm = onConfirm != null || textConfirm != null;  
547 - actions ??= [];  
548 -  
549 - if (cancel != null) {  
550 - actions.add(cancel);  
551 - } else {  
552 - if (leanCancel) {  
553 - actions.add(FlatButton(  
554 - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,  
555 - onPressed: () {  
556 - onCancel?.call();  
557 - back();  
558 - },  
559 - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8),  
560 - child: Text(  
561 - textCancel ?? "Cancel",  
562 - style: TextStyle(color: cancelTextColor ?? theme.accentColor),  
563 - ),  
564 - shape: RoundedRectangleBorder(  
565 - side: BorderSide(  
566 - color: buttonColor ?? theme.accentColor,  
567 - width: 2,  
568 - style: BorderStyle.solid),  
569 - borderRadius: BorderRadius.circular(100)),  
570 - ));  
571 - }  
572 - }  
573 - if (confirm != null) {  
574 - actions.add(confirm);  
575 - } else {  
576 - if (leanConfirm) {  
577 - actions.add(FlatButton(  
578 - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,  
579 - color: buttonColor ?? theme.accentColor,  
580 - shape: RoundedRectangleBorder(  
581 - borderRadius: BorderRadius.circular(100)),  
582 - child: Text(  
583 - textConfirm ?? "Ok",  
584 - style: TextStyle(color: confirmTextColor ?? theme.primaryColor),  
585 - ),  
586 - onPressed: () {  
587 - onConfirm?.call();  
588 - }));  
589 - }  
590 - }  
591 -  
592 - return dialog(  
593 - AlertDialog(  
594 - titlePadding: EdgeInsets.all(8),  
595 - contentPadding: EdgeInsets.all(8),  
596 - backgroundColor: backgroundColor ?? theme.dialogBackgroundColor,  
597 - shape: RoundedRectangleBorder(  
598 - borderRadius: BorderRadius.all(Radius.circular(radius))),  
599 - title: Text(title, textAlign: TextAlign.center, style: titleStyle),  
600 - content: Column(  
601 - crossAxisAlignment: CrossAxisAlignment.center,  
602 - mainAxisSize: MainAxisSize.min,  
603 - children: [  
604 - content ??  
605 - Text(middleText ?? "",  
606 - textAlign: TextAlign.center, style: middleTextStyle),  
607 - SizedBox(height: 16),  
608 - ButtonTheme(  
609 - minWidth: 78.0,  
610 - height: 34.0,  
611 - child: Wrap(  
612 - alignment: WrapAlignment.center,  
613 - spacing: 8,  
614 - runSpacing: 8,  
615 - children: actions,  
616 - ),  
617 - )  
618 - ],  
619 - ),  
620 - // actions: actions, // ?? <Widget>[cancelButton, confirmButton],  
621 - buttonPadding: EdgeInsets.zero,  
622 - ),  
623 - barrierDismissible: barrierDismissible,  
624 - );  
625 - }  
626 -  
627 - Future<T> bottomSheet<T>(  
628 - Widget bottomsheet, {  
629 - Color backgroundColor,  
630 - double elevation,  
631 - bool persistent = true,  
632 - ShapeBorder shape,  
633 - Clip clipBehavior,  
634 - Color barrierColor,  
635 - bool ignoreSafeArea,  
636 - bool isScrollControlled = false,  
637 - bool useRootNavigator = false,  
638 - bool isDismissible = true,  
639 - bool enableDrag = true,  
640 - RouteSettings settings,  
641 - Duration enterBottomSheetDuration,  
642 - Duration exitBottomSheetDuration,  
643 - }) {  
644 - assert(bottomsheet != null);  
645 - assert(persistent != null);  
646 - assert(isScrollControlled != null);  
647 - assert(useRootNavigator != null);  
648 - assert(isDismissible != null);  
649 - assert(enableDrag != null);  
650 -  
651 - return Navigator.of(overlayContext, rootNavigator: useRootNavigator)  
652 - .push(GetModalBottomSheetRoute<T>(  
653 - builder: (_) => bottomsheet,  
654 - isPersistent: persistent,  
655 - theme: Theme.of(key.currentContext, shadowThemeOnly: true),  
656 - isScrollControlled: isScrollControlled,  
657 - barrierLabel:  
658 - MaterialLocalizations.of(key.currentContext).modalBarrierDismissLabel,  
659 - backgroundColor: backgroundColor ?? Colors.transparent,  
660 - elevation: elevation,  
661 - shape: shape,  
662 - removeTop: ignoreSafeArea ?? true,  
663 - clipBehavior: clipBehavior,  
664 - isDismissible: isDismissible,  
665 - modalBarrierColor: barrierColor,  
666 - settings: settings,  
667 - enableDrag: enableDrag,  
668 - ));  
669 - }  
670 -  
671 - void rawSnackbar({  
672 - String title,  
673 - String message,  
674 - Widget titleText,  
675 - Widget messageText,  
676 - Widget icon,  
677 - bool instantInit = true,  
678 - bool shouldIconPulse = true,  
679 - double maxWidth,  
680 - EdgeInsets margin = const EdgeInsets.all(0.0),  
681 - EdgeInsets padding = const EdgeInsets.all(16),  
682 - double borderRadius = 0.0,  
683 - Color borderColor,  
684 - double borderWidth = 1.0,  
685 - Color backgroundColor = const Color(0xFF303030),  
686 - Color leftBarIndicatorColor,  
687 - List<BoxShadow> boxShadows,  
688 - Gradient backgroundGradient,  
689 - FlatButton mainButton,  
690 - OnTap onTap,  
691 - Duration duration = const Duration(seconds: 3),  
692 - bool isDismissible = true,  
693 - SnackDismissDirection dismissDirection = SnackDismissDirection.VERTICAL,  
694 - bool showProgressIndicator = false,  
695 - AnimationController progressIndicatorController,  
696 - Color progressIndicatorBackgroundColor,  
697 - Animation<Color> progressIndicatorValueColor,  
698 - SnackPosition snackPosition = SnackPosition.BOTTOM,  
699 - SnackStyle snackStyle = SnackStyle.FLOATING,  
700 - Curve forwardAnimationCurve = Curves.easeOutCirc,  
701 - Curve reverseAnimationCurve = Curves.easeOutCirc,  
702 - Duration animationDuration = const Duration(seconds: 1),  
703 - SnackbarStatusCallback snackbarStatus,  
704 - double barBlur = 0.0,  
705 - double overlayBlur = 0.0,  
706 - Color overlayColor,  
707 - Form userInputForm,  
708 - }) async {  
709 - final getBar = GetBar(  
710 - snackbarStatus: snackbarStatus,  
711 - title: title,  
712 - message: message,  
713 - titleText: titleText,  
714 - messageText: messageText,  
715 - snackPosition: snackPosition,  
716 - borderRadius: borderRadius,  
717 - margin: margin,  
718 - duration: duration,  
719 - barBlur: barBlur,  
720 - backgroundColor: backgroundColor,  
721 - icon: icon,  
722 - shouldIconPulse: shouldIconPulse,  
723 - maxWidth: maxWidth,  
724 - padding: padding,  
725 - borderColor: borderColor,  
726 - borderWidth: borderWidth,  
727 - leftBarIndicatorColor: leftBarIndicatorColor,  
728 - boxShadows: boxShadows,  
729 - backgroundGradient: backgroundGradient,  
730 - mainButton: mainButton,  
731 - onTap: onTap,  
732 - isDismissible: isDismissible,  
733 - dismissDirection: dismissDirection,  
734 - showProgressIndicator: showProgressIndicator ?? false,  
735 - progressIndicatorController: progressIndicatorController,  
736 - progressIndicatorBackgroundColor: progressIndicatorBackgroundColor,  
737 - progressIndicatorValueColor: progressIndicatorValueColor,  
738 - snackStyle: snackStyle,  
739 - forwardAnimationCurve: forwardAnimationCurve,  
740 - reverseAnimationCurve: reverseAnimationCurve,  
741 - animationDuration: animationDuration,  
742 - overlayBlur: overlayBlur,  
743 - overlayColor: overlayColor,  
744 - userInputForm: userInputForm,  
745 - );  
746 -  
747 - if (instantInit) {  
748 - getBar.show();  
749 - } else {  
750 - SchedulerBinding.instance.addPostFrameCallback((_) {  
751 - getBar.show();  
752 - });  
753 - }  
754 - }  
755 -  
756 - Future<T> showSnackbar<T>(GetBar snackbar) {  
757 - return key?.currentState?.push(SnackRoute<T>(snack: snackbar));  
758 - }  
759 -  
760 - void snackbar(  
761 - String title,  
762 - String message, {  
763 - Color colorText,  
764 - Duration duration,  
765 -  
766 - /// with instantInit = false you can put snackbar on initState  
767 - bool instantInit = true,  
768 - SnackPosition snackPosition,  
769 - Widget titleText,  
770 - Widget messageText,  
771 - Widget icon,  
772 - bool shouldIconPulse,  
773 - double maxWidth,  
774 - EdgeInsets margin,  
775 - EdgeInsets padding,  
776 - double borderRadius,  
777 - Color borderColor,  
778 - double borderWidth,  
779 - Color backgroundColor,  
780 - Color leftBarIndicatorColor,  
781 - List<BoxShadow> boxShadows,  
782 - Gradient backgroundGradient,  
783 - FlatButton mainButton,  
784 - OnTap onTap,  
785 - bool isDismissible,  
786 - bool showProgressIndicator,  
787 - SnackDismissDirection dismissDirection,  
788 - AnimationController progressIndicatorController,  
789 - Color progressIndicatorBackgroundColor,  
790 - Animation<Color> progressIndicatorValueColor,  
791 - SnackStyle snackStyle,  
792 - Curve forwardAnimationCurve,  
793 - Curve reverseAnimationCurve,  
794 - Duration animationDuration,  
795 - double barBlur,  
796 - double overlayBlur,  
797 - SnackbarStatusCallback snackbarStatus,  
798 - Color overlayColor,  
799 - Form userInputForm,  
800 - }) async {  
801 - final getBar = GetBar(  
802 - snackbarStatus: snackbarStatus,  
803 - titleText: (title == null)  
804 - ? null  
805 - : titleText ??  
806 - Text(  
807 - title,  
808 - style: TextStyle(  
809 - color: colorText ?? iconColor ?? Colors.black,  
810 - fontWeight: FontWeight.w800,  
811 - fontSize: 16,  
812 - ),  
813 - ),  
814 - messageText: messageText ??  
815 - Text(  
816 - message,  
817 - style: TextStyle(  
818 - color: colorText ?? iconColor ?? Colors.black,  
819 - fontWeight: FontWeight.w300,  
820 - fontSize: 14,  
821 - ),  
822 - ),  
823 - snackPosition: snackPosition ?? SnackPosition.TOP,  
824 - borderRadius: borderRadius ?? 15,  
825 - margin: margin ?? EdgeInsets.symmetric(horizontal: 10),  
826 - duration: duration ?? Duration(seconds: 3),  
827 - barBlur: barBlur ?? 7.0,  
828 - backgroundColor: backgroundColor ?? Colors.grey.withOpacity(0.2),  
829 - icon: icon,  
830 - shouldIconPulse: shouldIconPulse ?? true,  
831 - maxWidth: maxWidth,  
832 - padding: padding ?? EdgeInsets.all(16),  
833 - borderColor: borderColor,  
834 - borderWidth: borderWidth,  
835 - leftBarIndicatorColor: leftBarIndicatorColor,  
836 - boxShadows: boxShadows,  
837 - backgroundGradient: backgroundGradient,  
838 - mainButton: mainButton,  
839 - onTap: onTap,  
840 - isDismissible: isDismissible ?? true,  
841 - dismissDirection: dismissDirection ?? SnackDismissDirection.VERTICAL,  
842 - showProgressIndicator: showProgressIndicator ?? false,  
843 - progressIndicatorController: progressIndicatorController,  
844 - progressIndicatorBackgroundColor: progressIndicatorBackgroundColor,  
845 - progressIndicatorValueColor: progressIndicatorValueColor,  
846 - snackStyle: snackStyle ?? SnackStyle.FLOATING,  
847 - forwardAnimationCurve: forwardAnimationCurve ?? Curves.easeOutCirc,  
848 - reverseAnimationCurve: reverseAnimationCurve ?? Curves.easeOutCirc,  
849 - animationDuration: animationDuration ?? Duration(seconds: 1),  
850 - overlayBlur: overlayBlur ?? 0.0,  
851 - overlayColor: overlayColor ?? Colors.transparent,  
852 - userInputForm: userInputForm);  
853 -  
854 - if (instantInit) {  
855 - showSnackbar(getBar);  
856 - } else {  
857 - routing.isSnackbar = true;  
858 - SchedulerBinding.instance.addPostFrameCallback((_) {  
859 - showSnackbar(getBar);  
860 - });  
861 - }  
862 - }  
863 -  
864 - void addPages(List<GetPage> getPages) {  
865 - if (getPages != null) {  
866 - if (routeTree == null) {  
867 - routeTree = ParseRouteTree();  
868 - }  
869 -  
870 - for (final element in getPages) {  
871 - routeTree.addRoute(element);  
872 - }  
873 - }  
874 - }  
875 -  
876 - void addPage(GetPage getPage) {  
877 - if (getPage != null) {  
878 - if (routeTree == null) routeTree = ParseRouteTree();  
879 - routeTree.addRoute(getPage);  
880 - }  
881 - }  
882 -  
883 - /// change default config of Get  
884 - void config(  
885 - {bool enableLog,  
886 - LogWriterCallback logWriterCallback,  
887 - bool defaultPopGesture,  
888 - bool defaultOpaqueRoute,  
889 - Duration defaultDurationTransition,  
890 - bool defaultGlobalState,  
891 - Transition defaultTransition}) {  
892 - if (enableLog != null) {  
893 - Get.isLogEnable = enableLog;  
894 - }  
895 - if (logWriterCallback != null) {  
896 - Get.log = logWriterCallback;  
897 - }  
898 - if (defaultPopGesture != null) {  
899 - getxController.defaultPopGesture = defaultPopGesture;  
900 - }  
901 - if (defaultOpaqueRoute != null) {  
902 - getxController.defaultOpaqueRoute = defaultOpaqueRoute;  
903 - }  
904 - if (defaultTransition != null) {  
905 - getxController.defaultTransition = defaultTransition;  
906 - }  
907 -  
908 - if (defaultDurationTransition != null) {  
909 - getxController.defaultTransitionDuration = defaultDurationTransition;  
910 - }  
911 - }  
912 -  
913 - void updateLocale(Locale l) {  
914 - Get.locale = l;  
915 - forceAppUpdate();  
916 - }  
917 -  
918 - void forceAppUpdate() {  
919 - void restart(Element element) {  
920 - element.markNeedsBuild();  
921 - element.visitChildren(restart);  
922 - }  
923 -  
924 - restart(Get.context as Element);  
925 - }  
926 -  
927 - void appUpdate() => getxController.update();  
928 -  
929 - void changeTheme(ThemeData theme) {  
930 - getxController.setTheme(theme);  
931 - }  
932 -  
933 - void changeThemeMode(ThemeMode themeMode) {  
934 - getxController.setThemeMode(themeMode);  
935 - }  
936 -  
937 - GlobalKey<NavigatorState> addKey(GlobalKey<NavigatorState> newKey) {  
938 - getxController.key = newKey;  
939 - return key;  
940 - }  
941 -  
942 - GlobalKey<NavigatorState> nestedKey(int key) {  
943 - keys.putIfAbsent(key, () => GlobalKey<NavigatorState>());  
944 - return keys[key];  
945 - }  
946 -  
947 - GlobalKey<NavigatorState> global(int k) {  
948 - GlobalKey<NavigatorState> _key;  
949 - if (k == null) {  
950 - _key = key;  
951 - } else {  
952 - if (!keys.containsKey(k)) {  
953 - throw 'Route id ($k) not found';  
954 - }  
955 - _key = keys[k];  
956 - }  
957 -  
958 - if (_key.currentContext == null) {  
959 - throw """You are trying to use contextless navigation without  
960 - a GetMaterialApp or Get.key.  
961 - If you are testing your app, you can use:  
962 - [Get.testMode = true], or if you are running your app on  
963 - a physical device or emulator, you must exchange your [MaterialApp]  
964 - for a [GetMaterialApp].  
965 - """;  
966 - }  
967 -  
968 - return _key;  
969 - }  
970 -  
971 - @Deprecated('''  
972 -Since version 2.8 it is possible to access the properties  
973 -[Get.arguments] and [Get.currentRoute] directly.  
974 -[routeSettings] is useless and should not be used.''')  
975 - RouteSettings get routeSettings => null;  
976 -  
977 - /// give current arguments  
978 - dynamic get arguments => routing.args;  
979 -  
980 - /// give name from current route  
981 - String get currentRoute => routing.current;  
982 -  
983 - /// give name from previous route  
984 - String get previousRoute => routing.previous;  
985 -  
986 - /// check if snackbar is open  
987 - bool get isSnackbarOpen => routing.isSnackbar;  
988 -  
989 - /// check if dialog is open  
990 - bool get isDialogOpen => routing.isDialog;  
991 -  
992 - /// check if bottomsheet is open  
993 - bool get isBottomSheetOpen => routing.isBottomSheet;  
994 -  
995 - /// check a raw current route  
996 - Route<dynamic> get rawRoute => routing.route;  
997 -  
998 - /// check if popGesture is enable  
999 - bool get isPopGestureEnable => defaultPopGesture;  
1000 -  
1001 - /// check if default opaque route is enable  
1002 - bool get isOpaqueRouteDefault => defaultOpaqueRoute;  
1003 -  
1004 - /// give access to currentContext  
1005 - BuildContext get context => key?.currentContext;  
1006 -  
1007 - /// give access to current Overlay Context  
1008 - BuildContext get overlayContext => key?.currentState?.overlay?.context;  
1009 -  
1010 - /// give access to Theme.of(context)  
1011 - ThemeData get theme {  
1012 - ThemeData _theme;  
1013 - if (context != null) {  
1014 - _theme = Theme.of(context);  
1015 - }  
1016 - return _theme;  
1017 - }  
1018 -  
1019 - /// give access to TextTheme.of(context)  
1020 - TextTheme get textTheme => theme?.textTheme;  
1021 -  
1022 - /// give access to Mediaquery.of(context)  
1023 - MediaQueryData get mediaQuery => MediaQuery.of(context);  
1024 -  
1025 - /// Check if dark mode theme is enable  
1026 - bool get isDarkMode => (theme.brightness == Brightness.dark);  
1027 -  
1028 - /// Check if dark mode theme is enable on platform on android Q+  
1029 - bool get isPlatformDarkMode =>  
1030 - (mediaQuery.platformBrightness == Brightness.dark);  
1031 -  
1032 - /// give access to Theme.of(context).iconTheme.color  
1033 - Color get iconColor => theme?.iconTheme?.color;  
1034 -  
1035 - /// give access to FocusScope.of(context)  
1036 - FocusNode get focusScope => FocusManager.instance.primaryFocus;  
1037 -  
1038 - /// give access to Immutable MediaQuery.of(context).size.height  
1039 - double get height => MediaQuery.of(context).size.height;  
1040 -  
1041 - /// give access to Immutable MediaQuery.of(context).size.width  
1042 - double get width => MediaQuery.of(context).size.width;  
1043 -  
1044 - GlobalKey<NavigatorState> get key {  
1045 - final _key = getxController?.key;  
1046 -  
1047 - return _key;  
1048 - }  
1049 -  
1050 - Map<int, GlobalKey<NavigatorState>> get keys => getxController?.keys;  
1051 -  
1052 - GetMaterialController get rootController => getxController;  
1053 -  
1054 - bool get defaultPopGesture => getxController.defaultPopGesture;  
1055 - bool get defaultOpaqueRoute => getxController.defaultOpaqueRoute;  
1056 -  
1057 - Transition get defaultTransition => getxController.defaultTransition;  
1058 -  
1059 - Duration get defaultTransitionDuration {  
1060 - return getxController.defaultTransitionDuration;  
1061 - }  
1062 -  
1063 - Curve get defaultTransitionCurve => getxController.defaultTransitionCurve;  
1064 -  
1065 - Curve get defaultDialogTransitionCurve {  
1066 - return getxController.defaultDialogTransitionCurve;  
1067 - }  
1068 -  
1069 - Duration get defaultDialogTransitionDuration {  
1070 - return getxController.defaultDialogTransitionDuration;  
1071 - }  
1072 -  
1073 - Routing get routing => getxController.routing;  
1074 -  
1075 - Map<String, String> get parameters => getxController.parameters;  
1076 - set parameters(Map<String, String> newParameters) =>  
1077 - getxController.parameters = newParameters;  
1078 -  
1079 - ParseRouteTree get routeTree => getxController.routeTree;  
1080 - set routeTree(ParseRouteTree tree) => getxController.routeTree = tree;  
1081 -  
1082 - CustomTransition get customTransition => getxController.customTransition;  
1083 - set customTransition(CustomTransition newTransition) =>  
1084 - getxController.customTransition = newTransition;  
1085 -  
1086 - bool get testMode => getxController.testMode;  
1087 - set testMode(bool isTest) => getxController.testMode = isTest;  
1088 -  
1089 - static GetMaterialController getxController = GetMaterialController();  
1090 -}  
1091 -  
1092 -/// It replaces the Flutter Navigator, but needs no context.  
1093 -/// You can to use navigator.push(YourRoute()) rather  
1094 -/// Navigator.push(context, YourRoute());  
1095 -NavigatorState get navigator => GetNavigation(Get).key.currentState;  
1 -import 'package:flutter/widgets.dart';  
2 -  
3 -import '../routes/get_route.dart';  
4 -  
5 -class ParseRouteTree {  
6 - final List<_ParseRouteTreeNode> _nodes = <_ParseRouteTreeNode>[];  
7 -  
8 - // bool _hasDefaultRoute = false;  
9 -  
10 - void addRoute(GetPage route) {  
11 - var path = route.name;  
12 -  
13 - if (path == Navigator.defaultRouteName) {  
14 - // if (_hasDefaultRoute) {  
15 - // throw ("Default route was already defined");  
16 - // }  
17 - var node = _ParseRouteTreeNode(path, _ParseRouteTreeNodeType.component);  
18 - node.routes = [route];  
19 - _nodes.add(node);  
20 - // _hasDefaultRoute = true;  
21 - return;  
22 - }  
23 - if (path.startsWith("/")) {  
24 - path = path.substring(1);  
25 - }  
26 - var pathComponents = path.split('/');  
27 - _ParseRouteTreeNode parent;  
28 - for (var i = 0; i < pathComponents.length; i++) {  
29 - var component = pathComponents[i];  
30 - var node = _nodeForComponent(component, parent);  
31 - if (node == null) {  
32 - var type = _typeForComponent(component);  
33 - node = _ParseRouteTreeNode(component, type);  
34 - node.parent = parent;  
35 - if (parent == null) {  
36 - _nodes.add(node);  
37 - } else {  
38 - parent.nodes.add(node);  
39 - }  
40 - }  
41 - if (i == pathComponents.length - 1) {  
42 - if (node.routes == null) {  
43 - node.routes = [route];  
44 - } else {  
45 - node.routes.add(route);  
46 - }  
47 - }  
48 - parent = node;  
49 - }  
50 - }  
51 -  
52 - _GetPageMatch matchRoute(String path) {  
53 - var usePath = path;  
54 - if (usePath.startsWith("/")) {  
55 - usePath = path.substring(1);  
56 - }  
57 -  
58 - // should take off url parameters first..  
59 - final uri = Uri.tryParse(usePath);  
60 -// List<String> components = usePath.split("/");  
61 - var components = uri.pathSegments;  
62 - if (path == Navigator.defaultRouteName) {  
63 - components = ["/"];  
64 - }  
65 - var nodeMatches = <_ParseRouteTreeNode, _ParseRouteTreeNodeMatch>{};  
66 - var nodesToCheck = _nodes;  
67 - for (final checkComponent in components) {  
68 - final currentMatches = <_ParseRouteTreeNode, _ParseRouteTreeNodeMatch>{};  
69 - final nextNodes = <_ParseRouteTreeNode>[];  
70 - for (final node in nodesToCheck) {  
71 - var pathPart = checkComponent;  
72 - var queryMap = <String, String>{};  
73 -  
74 - if (checkComponent.contains("?") && !checkComponent.contains("=")) {  
75 - var splitParam = checkComponent.split("?");  
76 - pathPart = splitParam[0];  
77 - queryMap = {pathPart: splitParam[1]};  
78 - } else if (checkComponent.contains("?")) {  
79 - var splitParam = checkComponent.split("?");  
80 - var splitParam2 = splitParam[1].split("=");  
81 - if (!splitParam2[1].contains("&")) {  
82 - pathPart = splitParam[0];  
83 - queryMap = {splitParam2[0]: splitParam2[1]};  
84 - } else {  
85 - pathPart = splitParam[0];  
86 - final second = splitParam[1];  
87 - var other = second.split(RegExp(r"[&,=]"));  
88 - for (var i = 0; i < (other.length - 1); i++) {  
89 - var isOdd = (i % 2 == 0);  
90 - if (isOdd) {  
91 - queryMap.addAll({other[0 + i]: other[1 + i]});  
92 - }  
93 - }  
94 - }  
95 - }  
96 -  
97 - final isMatch = (node.part == pathPart || node.isParameter());  
98 - if (isMatch) {  
99 - final parentMatch = nodeMatches[node.parent];  
100 - final match = _ParseRouteTreeNodeMatch.fromMatch(parentMatch, node);  
101 -  
102 - // TODO: find a way to clean this implementation.  
103 - match.parameters.addAll(uri.queryParameters);  
104 -  
105 - if (node.isParameter()) {  
106 - final paramKey = node.part.substring(1);  
107 - match.parameters[paramKey] = pathPart;  
108 - }  
109 - if (queryMap != null) {  
110 - match.parameters.addAll(queryMap);  
111 - }  
112 -  
113 - currentMatches[node] = match;  
114 - if (node.nodes != null) {  
115 - nextNodes.addAll(node.nodes);  
116 - }  
117 - }  
118 - }  
119 - nodeMatches = currentMatches;  
120 - nodesToCheck = nextNodes;  
121 - if (currentMatches.values.length == 0) {  
122 - return null;  
123 - }  
124 - }  
125 - var matches = nodeMatches.values.toList();  
126 - if (matches.length > 0) {  
127 - var match = matches.first;  
128 - var nodeToUse = match.node;  
129 -  
130 - if (nodeToUse != null &&  
131 - nodeToUse.routes != null &&  
132 - nodeToUse.routes.length > 0) {  
133 - var routes = nodeToUse.routes;  
134 - var routeMatch = _GetPageMatch(routes[0]);  
135 -  
136 - routeMatch.parameters = match.parameters;  
137 -  
138 - return routeMatch;  
139 - }  
140 - }  
141 - return null;  
142 - }  
143 -  
144 - _ParseRouteTreeNode _nodeForComponent(  
145 - String component,  
146 - _ParseRouteTreeNode parent,  
147 - ) {  
148 - var nodes = _nodes;  
149 - if (parent != null) {  
150 - nodes = parent.nodes;  
151 - }  
152 - for (var node in nodes) {  
153 - if (node.part == component) {  
154 - return node;  
155 - }  
156 - }  
157 - return null;  
158 - }  
159 -  
160 - _ParseRouteTreeNodeType _typeForComponent(String component) {  
161 - var type = _ParseRouteTreeNodeType.component;  
162 - if (_isParameterComponent(component)) {  
163 - type = _ParseRouteTreeNodeType.parameter;  
164 - }  
165 - return type;  
166 - }  
167 -  
168 - bool _isParameterComponent(String component) {  
169 - return component.startsWith(":");  
170 - }  
171 -  
172 - Map<String, String> parseQueryString(String query) {  
173 - var search = RegExp('([^&=]+)=?([^&]*)');  
174 - var params = <String, String>{};  
175 - if (query.startsWith('?')) query = query.substring(1);  
176 - decode(String s) => Uri.decodeComponent(s.replaceAll('+', ' '));  
177 -  
178 - for (Match match in search.allMatches(query)) {  
179 - var key = decode(match.group(1));  
180 - final value = decode(match.group(2));  
181 - params[key] = value;  
182 - }  
183 - return params;  
184 - }  
185 -}  
186 -  
187 -class _ParseRouteTreeNodeMatch {  
188 - _ParseRouteTreeNodeMatch(this.node);  
189 -  
190 - _ParseRouteTreeNodeMatch.fromMatch(  
191 - _ParseRouteTreeNodeMatch match, this.node) {  
192 - parameters = <String, String>{};  
193 - if (match != null) {  
194 - parameters.addAll(match.parameters);  
195 - }  
196 - }  
197 -  
198 - _ParseRouteTreeNode node;  
199 - Map<String, String> parameters = <String, String>{};  
200 -}  
201 -  
202 -class _ParseRouteTreeNode {  
203 - _ParseRouteTreeNode(this.part, this.type);  
204 -  
205 - String part;  
206 - _ParseRouteTreeNodeType type;  
207 - List<GetPage> routes = <GetPage>[];  
208 - List<_ParseRouteTreeNode> nodes = <_ParseRouteTreeNode>[];  
209 - _ParseRouteTreeNode parent;  
210 -  
211 - bool isParameter() {  
212 - return type == _ParseRouteTreeNodeType.parameter;  
213 - }  
214 -}  
215 -  
216 -class _GetPageMatch {  
217 - _GetPageMatch(this.route);  
218 -  
219 - GetPage route;  
220 - Map<String, String> parameters = <String, String>{};  
221 -}  
222 -  
223 -enum _ParseRouteTreeNodeType {  
224 - component,  
225 - parameter,  
226 -}  
1 -import 'package:flutter/material.dart';  
2 -import 'package:get_state_manager/get_state_manager.dart';  
3 -import 'package:get_utils/get_utils.dart';  
4 -import '../routes/custom_transition.dart';  
5 -import '../routes/observers/route_observer.dart';  
6 -import '../routes/transitions_type.dart';  
7 -import 'parse_route.dart';  
8 -  
9 -class GetMaterialController extends GetxController {  
10 - bool testMode = false;  
11 - Key unikey;  
12 - ThemeData theme;  
13 - ThemeMode themeMode;  
14 -  
15 - bool defaultPopGesture = GetPlatform.isIOS;  
16 - bool defaultOpaqueRoute = true;  
17 -  
18 - Transition defaultTransition;  
19 - Duration defaultTransitionDuration = Duration(milliseconds: 300);  
20 - Curve defaultTransitionCurve = Curves.easeOutQuad;  
21 -  
22 - Curve defaultDialogTransitionCurve = Curves.easeOutQuad;  
23 -  
24 - Duration defaultDialogTransitionDuration = Duration(milliseconds: 300);  
25 -  
26 - final routing = Routing();  
27 -  
28 - Map<String, String> parameters = {};  
29 -  
30 - ParseRouteTree routeTree;  
31 -  
32 - CustomTransition customTransition;  
33 -  
34 - GlobalKey<NavigatorState> key = GlobalKey<NavigatorState>();  
35 -  
36 - Map<int, GlobalKey<NavigatorState>> keys = {};  
37 -  
38 - void setTheme(ThemeData value) {  
39 - theme = value;  
40 - update();  
41 - }  
42 -  
43 - void setThemeMode(ThemeMode value) {  
44 - themeMode = value;  
45 - update();  
46 - }  
47 -  
48 - void restartApp() {  
49 - unikey = UniqueKey();  
50 - update();  
51 - }  
52 -}  
1 -import 'package:flutter/foundation.dart';  
2 -import 'package:flutter/material.dart';  
3 -import 'package:get_core/get_core.dart';  
4 -import 'package:get_state_manager/get_state_manager.dart';  
5 -import 'package:get_utils/get_utils.dart';  
6 -import '../../get_navigation.dart';  
7 -import 'root_controller.dart';  
8 -  
9 -class GetMaterialApp extends StatelessWidget {  
10 - const GetMaterialApp({  
11 - Key key,  
12 - this.navigatorKey,  
13 - this.home,  
14 - this.routes = const <String, WidgetBuilder>{},  
15 - this.initialRoute,  
16 - this.onGenerateRoute,  
17 - this.onGenerateInitialRoutes,  
18 - this.onUnknownRoute,  
19 - this.navigatorObservers = const <NavigatorObserver>[],  
20 - this.builder,  
21 - this.translationsKeys,  
22 - this.translations,  
23 - this.textDirection,  
24 - this.title = '',  
25 - this.onGenerateTitle,  
26 - this.color,  
27 - this.customTransition,  
28 - this.onInit,  
29 - this.onDispose,  
30 - this.theme,  
31 - this.darkTheme,  
32 - this.themeMode = ThemeMode.system,  
33 - this.locale,  
34 - this.fallbackLocale,  
35 - this.localizationsDelegates,  
36 - this.localeListResolutionCallback,  
37 - this.localeResolutionCallback,  
38 - this.supportedLocales = const <Locale>[Locale('en', 'US')],  
39 - this.debugShowMaterialGrid = false,  
40 - this.showPerformanceOverlay = false,  
41 - this.checkerboardRasterCacheImages = false,  
42 - this.checkerboardOffscreenLayers = false,  
43 - this.showSemanticsDebugger = false,  
44 - this.debugShowCheckedModeBanner = true,  
45 - this.shortcuts,  
46 - this.smartManagement = SmartManagement.full,  
47 - this.initialBinding,  
48 - this.unknownRoute,  
49 - this.routingCallback,  
50 - this.defaultTransition,  
51 - // this.actions,  
52 - this.getPages,  
53 - this.opaqueRoute,  
54 - this.enableLog,  
55 - this.logWriterCallback,  
56 - this.popGesture,  
57 - this.transitionDuration,  
58 - this.defaultGlobalState,  
59 - }) : assert(routes != null),  
60 - assert(navigatorObservers != null),  
61 - assert(title != null),  
62 - assert(debugShowMaterialGrid != null),  
63 - assert(showPerformanceOverlay != null),  
64 - assert(checkerboardRasterCacheImages != null),  
65 - assert(checkerboardOffscreenLayers != null),  
66 - assert(showSemanticsDebugger != null),  
67 - assert(debugShowCheckedModeBanner != null),  
68 - super(key: key);  
69 -  
70 - final GlobalKey<NavigatorState> navigatorKey;  
71 - final Widget home;  
72 - final Map<String, WidgetBuilder> routes;  
73 - final String initialRoute;  
74 - final RouteFactory onGenerateRoute;  
75 - final InitialRouteListFactory onGenerateInitialRoutes;  
76 - final RouteFactory onUnknownRoute;  
77 - final List<NavigatorObserver> navigatorObservers;  
78 - final TransitionBuilder builder;  
79 - final String title;  
80 - final GenerateAppTitle onGenerateTitle;  
81 - final ThemeData theme;  
82 - final ThemeData darkTheme;  
83 - final ThemeMode themeMode;  
84 - final CustomTransition customTransition;  
85 - final Color color;  
86 - final Map<String, Map<String, String>> translationsKeys;  
87 - final Translations translations;  
88 - final TextDirection textDirection;  
89 - final Locale locale;  
90 - final Locale fallbackLocale;  
91 - final Iterable<LocalizationsDelegate<dynamic>> localizationsDelegates;  
92 - final LocaleListResolutionCallback localeListResolutionCallback;  
93 - final LocaleResolutionCallback localeResolutionCallback;  
94 - final Iterable<Locale> supportedLocales;  
95 - final bool showPerformanceOverlay;  
96 - final bool checkerboardRasterCacheImages;  
97 - final bool checkerboardOffscreenLayers;  
98 - final bool showSemanticsDebugger;  
99 - final bool debugShowCheckedModeBanner;  
100 - final Map<LogicalKeySet, Intent> shortcuts;  
101 -  
102 - // final Map<LocalKey, ActionFactory> actions;  
103 - final bool debugShowMaterialGrid;  
104 - final Function(Routing) routingCallback;  
105 - final Transition defaultTransition;  
106 - final bool opaqueRoute;  
107 - final VoidCallback onInit;  
108 - final VoidCallback onDispose;  
109 - final bool enableLog;  
110 - final LogWriterCallback logWriterCallback;  
111 - final bool popGesture;  
112 - final SmartManagement smartManagement;  
113 - final Bindings initialBinding;  
114 - final Duration transitionDuration;  
115 - final bool defaultGlobalState;  
116 - final List<GetPage> getPages;  
117 - final GetPage unknownRoute;  
118 -  
119 - Route<dynamic> generator(RouteSettings settings) {  
120 - final match = Get.routeTree.matchRoute(settings.name);  
121 - Get.parameters = match?.parameters;  
122 -  
123 - if (match?.route == null) {  
124 - return GetPageRoute(  
125 - page: unknownRoute.page,  
126 - parameter: unknownRoute.parameter,  
127 - settings:  
128 - RouteSettings(name: settings.name, arguments: settings.arguments),  
129 - curve: unknownRoute.curve,  
130 - opaque: unknownRoute.opaque,  
131 - customTransition: unknownRoute.customTransition,  
132 - binding: unknownRoute.binding,  
133 - bindings: unknownRoute.bindings,  
134 - transitionDuration:  
135 - (unknownRoute.transitionDuration ?? Get.defaultTransitionDuration),  
136 - transition: unknownRoute.transition,  
137 - popGesture: unknownRoute.popGesture,  
138 - fullscreenDialog: unknownRoute.fullscreenDialog,  
139 - );  
140 - }  
141 -  
142 - return GetPageRoute(  
143 - page: match.route.page,  
144 - parameter: match.route.parameter,  
145 - settings:  
146 - RouteSettings(name: settings.name, arguments: settings.arguments),  
147 - curve: match.route.curve,  
148 - opaque: match.route.opaque,  
149 - customTransition: match.route.customTransition,  
150 - binding: match.route.binding,  
151 - bindings: match.route.bindings,  
152 - transitionDuration:  
153 - (match.route.transitionDuration ?? Get.defaultTransitionDuration),  
154 - transition: match.route.transition,  
155 - popGesture: match.route.popGesture,  
156 - fullscreenDialog: match.route.fullscreenDialog,  
157 - );  
158 - }  
159 -  
160 - List<Route<dynamic>> initialRoutesGenerate(String name) {  
161 - final match = Get.routeTree.matchRoute(name);  
162 - Get.parameters = match?.parameters;  
163 -  
164 - //Route can be nullable, just pass the unknown route  
165 - if (match?.route == null) {  
166 - return [  
167 - GetPageRoute(  
168 - page: unknownRoute.page,  
169 - parameter: unknownRoute.parameter,  
170 - settings: RouteSettings(name: name, arguments: null),  
171 - curve: unknownRoute.curve,  
172 - opaque: unknownRoute.opaque,  
173 - customTransition: unknownRoute.customTransition,  
174 - binding: unknownRoute.binding,  
175 - bindings: unknownRoute.bindings,  
176 - transitionDuration: (unknownRoute.transitionDuration ??  
177 - Get.defaultTransitionDuration),  
178 - transition: unknownRoute.transition,  
179 - popGesture: unknownRoute.popGesture,  
180 - fullscreenDialog: unknownRoute.fullscreenDialog,  
181 - )  
182 - ];  
183 - }  
184 -  
185 - return [  
186 - GetPageRoute(  
187 - page: match.route.page,  
188 - parameter: match.route.parameter,  
189 - settings: RouteSettings(name: name, arguments: null),  
190 - curve: match.route.curve,  
191 - opaque: match.route.opaque,  
192 - binding: match.route.binding,  
193 - bindings: match.route.bindings,  
194 - transitionDuration:  
195 - (match.route.transitionDuration ?? Get.defaultTransitionDuration),  
196 - transition: match.route.transition,  
197 - popGesture: match.route.popGesture,  
198 - fullscreenDialog: match.route.fullscreenDialog,  
199 - )  
200 - ];  
201 - }  
202 -  
203 - @override  
204 - Widget build(BuildContext context) {  
205 - return GetBuilder<GetMaterialController>(  
206 - init: Get.rootController,  
207 - dispose: (d) {  
208 - onDispose?.call();  
209 - },  
210 - initState: (i) {  
211 - if (locale != null) Get.locale = locale;  
212 -  
213 - if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale;  
214 -  
215 - if (translations != null) {  
216 - Get.addTranslations(translations.keys);  
217 - } else if (translationsKeys != null) {  
218 - Get.addTranslations(translationsKeys);  
219 - }  
220 -  
221 - Get.customTransition = customTransition;  
222 -  
223 - initialBinding?.dependencies();  
224 - Get.addPages(getPages);  
225 - Get.smartManagement = smartManagement;  
226 - onInit?.call();  
227 -  
228 - Get.config(  
229 - enableLog: enableLog ?? Get.isLogEnable,  
230 - logWriterCallback: logWriterCallback,  
231 - defaultTransition: defaultTransition ?? Get.defaultTransition,  
232 - defaultOpaqueRoute: opaqueRoute ?? Get.isOpaqueRouteDefault,  
233 - defaultPopGesture: popGesture ?? Get.isPopGestureEnable,  
234 - defaultDurationTransition:  
235 - transitionDuration ?? Get.defaultTransitionDuration,  
236 - );  
237 - },  
238 - builder: (_) {  
239 - return MaterialApp(  
240 - key: _.unikey,  
241 - navigatorKey:  
242 - (navigatorKey == null ? Get.key : Get.addKey(navigatorKey)),  
243 - home: home,  
244 - routes: routes ?? const <String, WidgetBuilder>{},  
245 - initialRoute: initialRoute,  
246 - onGenerateRoute: (getPages != null ? generator : onGenerateRoute),  
247 - onGenerateInitialRoutes: (getPages == null || home != null)  
248 - ? onGenerateInitialRoutes  
249 - : initialRoutesGenerate,  
250 - onUnknownRoute: onUnknownRoute,  
251 - navigatorObservers: (navigatorObservers == null  
252 - ? <NavigatorObserver>[GetObserver(routingCallback, Get.routing)]  
253 - : <NavigatorObserver>[GetObserver(routingCallback, Get.routing)]  
254 - ..addAll(navigatorObservers)),  
255 - builder: (context, child) {  
256 - return Directionality(  
257 - textDirection: textDirection ??  
258 - (rtlLanguages.contains(Get.locale?.languageCode)  
259 - ? TextDirection.rtl  
260 - : TextDirection.ltr),  
261 - child: builder == null ? child : builder(context, child),  
262 - );  
263 - },  
264 - title: title ?? '',  
265 - onGenerateTitle: onGenerateTitle,  
266 - color: color,  
267 - theme: _.theme ?? theme ?? ThemeData.fallback(),  
268 - darkTheme: darkTheme,  
269 - themeMode: _.themeMode ?? themeMode ?? ThemeMode.system,  
270 - locale: Get.locale ?? locale,  
271 - localizationsDelegates: localizationsDelegates,  
272 - localeListResolutionCallback: localeListResolutionCallback,  
273 - localeResolutionCallback: localeResolutionCallback,  
274 - supportedLocales:  
275 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
276 - debugShowMaterialGrid: debugShowMaterialGrid ?? false,  
277 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
278 - checkerboardRasterCacheImages:  
279 - checkerboardRasterCacheImages ?? false,  
280 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
281 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
282 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true,  
283 - shortcuts: shortcuts,  
284 - // actions: actions,  
285 - );  
286 - });  
287 - }  
288 -}  
289 -  
290 -const List<String> rtlLanguages = <String>[  
291 - 'ar', // Arabic  
292 - 'fa', // Farsi  
293 - 'he', // Hebrew  
294 - 'ps', // Pashto  
295 - 'ur',  
296 -];  
297 -  
298 -abstract class Translations {  
299 - Map<String, Map<String, String>> get keys;  
300 -}