Ahmed Masoud

update ar readme

  1 +{
  2 + "cSpell.enableFiletypes": ["!markdown"]
  3 +}
  1 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/get.png)
  2 +
  3 +[![pub package](https://img.shields.io/pub/v/get.svg?label=get&color=blue)](https://pub.dev/packages/get)
  4 +[![likes](https://badges.bar/get/likes)](https://pub.dev/packages/get/score)
  5 +![building](https://github.com/jonataslaw/get/workflows/build/badge.svg)
  6 +[![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://pub.dev/packages/effective_dart)
  7 +[![Discord Shield](https://img.shields.io/discord/722900883784073290.svg?logo=discord)](https://discord.com/invite/9Hpt99N)
  8 +[![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](https://communityinviter.com/apps/getxworkspace/getx)
  9 +[![Telegram](https://img.shields.io/badge/chat-on%20Telegram-blue.svg)](https://t.me/joinchat/PhdbJRmsZNpAqSLJL6bH7g)
  10 +<a href="https://github.com/Solido/awesome-flutter">
  11 +<img alt="Awesome Flutter" src="https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square" />
  12 +</a>
  13 +<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 +
  15 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/getx.png)
  16 +
  17 +<div align="center">
  18 +
  19 +**Languages:**
  20 +
  21 +[![English](https://img.shields.io/badge/Language-English-blueviolet?style=for-the-badge)](README.md)
  22 +[![Vietnamese](https://img.shields.io/badge/Language-Vietnamese-blueviolet?style=for-the-badge)](README-vi.md)
  23 +[![Indonesian](https://img.shields.io/badge/Language-Indonesian-blueviolet?style=for-the-badge)](README.id-ID.md)
  24 +[![Urdu](https://img.shields.io/badge/Language-Urdu-blueviolet?style=for-the-badge)](README.ur-PK.md)
  25 +[![Chinese](https://img.shields.io/badge/Language-Chinese-blueviolet?style=for-the-badge)](README.zh-cn.md)
  26 +[![Portuguese](https://img.shields.io/badge/Language-Portuguese-blueviolet?style=for-the-badge)](README.pt-br.md)
  27 +[![Spanish](https://img.shields.io/badge/Language-Spanish-blueviolet?style=for-the-badge)](README-es.md)
  28 +[![Russian](https://img.shields.io/badge/Language-Russian-blueviolet?style=for-the-badge)](README.ru.md)
  29 +[![Polish](https://img.shields.io/badge/Language-Polish-blueviolet?style=for-the-badge)](README.pl.md)
  30 +[![Korean](https://img.shields.io/badge/Language-Korean-blueviolet?style=for-the-badge)](README.ko-kr.md)
  31 +[![French](https://img.shields.io/badge/Language-French-blueviolet?style=for-the-badge)](README-fr.md)
  32 +[![العربيه](https://img.shields.io/badge/Language-arabic-blueviolet?style=for-the-badge)](README-ar.md)
  33 +
  34 +</div>
  35 +<div dir="rtl">
  36 +
  37 +- [عن المكتبة](#عن-المكتبة)
  38 +- [التركيب](#التركيب)
  39 +- [بناء تطبيق العداد 🔢](#بناء-تطبيق-العداد-)
  40 +- [The Three pillars](#the-three-pillars)
  41 + - [State management](#state-management)
  42 + - [Reactive State Manager](#reactive-state-manager)
  43 + - [More details about state management](#more-details-about-state-management)
  44 + - [Route management](#route-management)
  45 + - [More details about route management](#more-details-about-route-management)
  46 + - [Dependency management](#dependency-management)
  47 + - [More details about dependency management](#more-details-about-dependency-management)
  48 +- [Utils](#utils)
  49 + - [Internationalization](#internationalization)
  50 + - [Translations](#translations)
  51 + - [Using translations](#using-translations)
  52 + - [Using translation with singular and plural](#using-translation-with-singular-and-plural)
  53 + - [Using translation with parameters](#using-translation-with-parameters)
  54 + - [Locales](#locales)
  55 + - [Change locale](#change-locale)
  56 + - [System locale](#system-locale)
  57 + - [Change Theme](#change-theme)
  58 + - [GetConnect](#getconnect)
  59 + - [Default configuration](#default-configuration)
  60 + - [Custom configuration](#custom-configuration)
  61 + - [GetPage Middleware](#getpage-middleware)
  62 + - [Priority](#priority)
  63 + - [Redirect](#redirect)
  64 + - [onPageCalled](#onpagecalled)
  65 + - [OnBindingsStart](#onbindingsstart)
  66 + - [OnPageBuildStart](#onpagebuildstart)
  67 + - [OnPageBuilt](#onpagebuilt)
  68 + - [OnPageDispose](#onpagedispose)
  69 + - [Other Advanced APIs](#other-advanced-apis)
  70 + - [Optional Global Settings and Manual configurations](#optional-global-settings-and-manual-configurations)
  71 + - [Local State Widgets](#local-state-widgets)
  72 + - [ValueBuilder](#valuebuilder)
  73 + - [ObxValue](#obxvalue)
  74 + - [Useful tips](#useful-tips)
  75 + - [StateMixin](#statemixin)
  76 + - [GetView](#getview)
  77 + - [GetResponsiveView](#getresponsiveview)
  78 + - [How to use it](#how-to-use-it)
  79 + - [GetWidget](#getwidget)
  80 + - [GetxService](#getxservice)
  81 + - [Tests](#tests)
  82 + - [Tips](#tips)
  83 + - [Mockito or mocktail](#mockito-or-mocktail)
  84 + - [Using Get.reset()](#using-getreset)
  85 + - [Get.testMode](#gettestmode)
  86 +- [Breaking changes from 2.0](#breaking-changes-from-20)
  87 +- [Why Getx?](#why-getx)
  88 +- [Community](#community)
  89 + - [Community channels](#community-channels)
  90 + - [How to contribute](#how-to-contribute)
  91 + - [Articles and videos](#articles-and-videos)
  92 +
  93 +# عن المكتبة
  94 +
  95 +- `GetX` مكتبه خفيفه وقوية لفلاتر , توفر المكتبه السرعه العاليه في التحكم في الحاله , نظام حقن `Ddependency injection` ذكي , والتحكم في التنقل بين الصفحات بسرعه وسهوله
  96 +
  97 +- `GetX`
  98 +- تعتمد علي 3 نقاط اساسية . **الانتاجية والسرعه والتنظيم**
  99 +
  100 + - **السرعه:** `GetX` تركز علي السرعه واقل استخدام للموارد,`GetX` لا تستخدم `Streams` او `ChangeNotifier`.
  101 +
  102 + - **الانتاجية:** `GetX` تستخدم طريقه سهله ومريحة في كتابة الكود , لا يهم ماذا تريد انت تبني , يوجد دائما طريقه اسهل لبناء باستخدام `GetX` , ستوفر ساعات من العمل وتوفر لك اعلي سرعه يمكن الوصل لها في تطبيقاتك عموما , يجب ان يهتم المطور بالتخلص من الموارد الغير مستخدمه من الذاكرة , مع `GetX` هذا غير ضروري لانه يتم التخلص من الموارد الغير مستخدمه من الذاكره تلقائيا, اذا اردت تركهم دائما في الذاكرة يمكنك ذلك لكن يجب عليك ان تستخدم `permanent: true` بالاضافه الي توفير الوقت تم تقليل امكانية ترك الموارد في الذاكره بدون التخلص منها , يتم حقن الموارد `lazy` افتراضيا
  103 +
  104 + - **التنظيم:** `GetX` تسمح لك بفصل الـ `view` عن الـ `presentation logic` و `business logic` باكامل,
  105 + بالنسبة للحقن `dependency injection` و التنقل بين الشاشات لا تحتاج فيهم `context` للتنقل بين الصفحات , ولا تحتاك `context` للوصول للموارد عن طريق widget tree, لذلك يتم الفصل بالكامل بين `presentation logic` و `business logic` لا تحتاج لحقن ال `Controllers/Models/Blocs`
  106 + داخل شجره العناصر `Widget Tree` خلال `MultiProvider`s.
  107 + لان , `GetX` تستخدم نظام حقن خاص بها ويمكنك من فصل الـ `DI` عن الوجهات بالكامل .
  108 +
  109 +- مع `Getx` تعرف ايه يكون الكود الخاص ب كل جزء في التطبيق , تساعدك في كتابة كود نظيف , بالاضافه الي سهوله التطوير مستقبلا , وهذا يمكنك من مشاركه الاجزاء `modules` امر صعب ليصبح سهل جدا .
  110 + `BLOC` كان نقطه البداية لهذا الامر وتظيم الكود بهذه الطريقه في فلاتر , عن طريق فصل كود البزنس عن الواجهات , `GetX` هي التطور لذلك الامر , وذلك عن طريق الاضافه الي ذلك فصل حقن الموارد وفصل التنقل بين الشاشات ايضا , وطبقه البيانات بالكامل ايضا , تعلم اين يكون كل شي في المشروع
  111 +
  112 +- `Getx` توفر لك السهوله في بناء المشروع والاستقرار كلما كبر حجم المشروع واقصي سرعه ممكن , توفر لك ايضا نظام كامل يعمل في تجانس تام , سهل للمبتدئين , ومنظم للخبراء , امن , مستقر , ومحدث باستمرار ويوفر لك موجموعه من الادوات لتسهل عليك
  113 +
  114 +- `GetX` ليست ضخمه , تمتلك المكتبة العديد من المميزات تجعلك تبدا في البرمجه بدون القلق عن اي شي كل ميزه منهم منقسمه عن الاخري ولا يبداو الا عندما تستخدمهم , اذا استخدمت جزء التحكم في الحاله فقط لن يتم استخدام جزء التنقل بين الشاشات في تطبيقك الا `Compiled` والعكس صحيح ! .
  115 +
  116 +-`Getx` لديها نظام شامل , ومجتمع كبير , وعداد كبير من المطورين , وسوف يتم تحديثها باستمرار , تعمل المكتبة علي كل الانظمه بنفس الكود دون تغيير `Android`, `iOS`, `Web`, `Mac`, `Linux`, `Windows` حتي علي الخادم يمكنك استخدام `Getx` لبناء تطبيقات الويب
  117 +**[Get Server](https://github.com/jonataslaw/get_server)**.
  118 +
  119 +**بالاضافه الي ذلك يمكن محاكاه الامر اكثر في فلاتر والخادم عن طريق [Get CLI](https://github.com/jonataslaw/get_cli)**.
  120 +
  121 +**وللمزيد من الانتاجية يمكنك استخدام اضافه للـ**
  122 +
  123 +- [فيجوال ستوديو كود](https://marketplace.visualstudio.com/items?itemName=get-snippets.get-snippets)
  124 +- [اندرويد استوديو و انتلج](https://plugins.jetbrains.com/plugin/14975-getx-snippets)
  125 +
  126 +# التركيب
  127 +
  128 +استخدم المكتبة في ملف `pubspec.yaml`
  129 +
  130 +<div dir="ltr" >
  131 +
  132 +```yaml
  133 +dependencies:
  134 + get:
  135 +```
  136 +
  137 +</div>
  138 +استدعي المكتبة في الملفات الي ستستخدمها
  139 +<div dir="ltr" >
  140 +
  141 +```dart
  142 +import 'package:get/get.dart';
  143 +```
  144 +
  145 +</div>
  146 +
  147 +# بناء تطبيق العداد 🔢
  148 +
  149 +تطبيق العداد الذي يتم انشاء مع كل مشروع جديد يتعدي ال 100 سطر (بالتعليقات) ولكي اريك مدي قوه `GetX`
  150 +ساوضح لك كيفيه بناء التطبيق مع تغير قيمه العداد مع كل ضغطه زر والتقل بين الشاشات ومشاركه الحاله كل ذلك بطريقه منذمه وفصل تام لكود البزنس عن الواجهات فقط ب 26 سطر من ضمنهم التعليقات 🔥
  151 +
  152 +- الخطوه الاولي :
  153 + اكتب `Get` امام `MaterialApp` لتصبح `GetMaterialApp`
  154 +
  155 +<div dir="ltr" >
  156 +
  157 +```dart
  158 +void main() => runApp(GetMaterialApp(home: Home()));
  159 +```
  160 +
  161 +</div>
  162 +
  163 +- ملحوظه : هذا لا يعتبر تعديل علي `MaterialApp` لان , `GetMaterialApp` عباره عن عنصر معد مسبقا ويستخدم `MaterialApp` تحت الغطاء , يمكن تغير الاعدادات يدوين لكن هذا غير ضروري لان ``سيقوم بعمل المسارات و حقن العناصر والترجمه وكل شي تحتاجه ولكن اذا كنت تنوي لاستخدام المكتبة فقط للتحكم في الحاله`State managment`فهذه الخطوه غير ضرورية تكون هذه الخطوه ضرورية عندما تريد التنقل بين الشاشات او عرض`snackbars`والترجمه و اي شي يعتمد علي`context`وتقوم`getx` بتوفيره
  164 +
  165 +- الخطوه الثانية
  166 + قم بكتابة الكود داخل `class` وكتابة المتغيرات والدوال , يمكنك جعل المتغير قابلع لاعاده بناء الواجها عند تغير قيمته باستخدام ال `getter` `.obs` .
  167 +
  168 +<div dir="ltr" >
  169 +
  170 +```dart
  171 +class Controller extends GetxController{
  172 + var count = 0.obs;
  173 + increment() => count++;
  174 +}
  175 +```
  176 +
  177 +</div>
  178 +
  179 +- الخطوه الثالثه
  180 +ابني الواجهه واستخدم `StatelessWidget` لتوفير الموارد , مع `Getx` يمكنك الاستغناء عن `StatefulWidget`.
  181 +<div dir="ltr" >
  182 +
  183 +```dart
  184 +class Home extends StatelessWidget {
  185 +
  186 + @override
  187 + Widget build(context) {
  188 +
  189 + // Instantiate your class using Get.put() to make it available for all "child" routes there.
  190 + final c = Get.put(Controller());
  191 +
  192 + return Scaffold(
  193 + // Use Obx(()=> to update Text() whenever count is changed.
  194 + appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
  195 +
  196 + // Replace the 8 lines Navigator.push by a simple Get.to(). You don't need context
  197 + body: Center(child: ElevatedButton(
  198 + child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
  199 + floatingActionButton:
  200 + FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  201 + }
  202 +}
  203 +
  204 +class Other extends StatelessWidget {
  205 + // You can ask Get to find a Controller that is being used by another page and redirect you to it.
  206 + final Controller c = Get.find();
  207 +
  208 + @override
  209 + Widget build(context){
  210 + // Access the updated count variable
  211 + return Scaffold(body: Center(child: Text("${c.count}")));
  212 + }
  213 +}
  214 +```
  215 +
  216 +</div>
  217 +
  218 +Result:
  219 +
  220 +![](https://raw.githubusercontent.com/jonataslaw/getx-community/master/counter-app-gif.gif)
  221 +
  222 +This is a simple project but it already makes clear how powerful Get is. As your project grows, this difference will become more significant.
  223 +
  224 +Get was designed to work with teams, but it makes the job of an individual developer simple.
  225 +
  226 +Improve your deadlines, deliver everything on time without losing performance. Get is not for everyone, but if you identified with that phrase, Get is for you!
  227 +
  228 +# The Three pillars
  229 +
  230 +## State management
  231 +
  232 +Get has two different state managers: the simple state manager (we'll call it GetBuilder) and the reactive state manager (GetX/Obx)
  233 +
  234 +### Reactive State Manager
  235 +
  236 +Reactive programming can alienate many people because it is said to be complicated. GetX turns reactive programming into something quite simple:
  237 +
  238 +- You won't need to create StreamControllers.
  239 +- You won't need to create a StreamBuilder for each variable
  240 +- You will not need to create a class for each state.
  241 +- You will not need to create a get for an initial value.
  242 +- You will not need to use code generators
  243 +
  244 +Reactive programming with Get is as easy as using setState.
  245 +
  246 +Let's imagine that you have a name variable and want that every time you change it, all widgets that use it are automatically changed.
  247 +
  248 +This is your count variable:
  249 +
  250 +```dart
  251 +var name = 'Jonatas Borges';
  252 +```
  253 +
  254 +To make it observable, you just need to add ".obs" to the end of it:
  255 +
  256 +```dart
  257 +var name = 'Jonatas Borges'.obs;
  258 +```
  259 +
  260 +And in the UI, when you want to show that value and update the screen whenever the values changes, simply do this:
  261 +
  262 +```dart
  263 +Obx(() => Text("${controller.name}"));
  264 +```
  265 +
  266 +That's all. It's _that_ simple.
  267 +
  268 +### More details about state management
  269 +
  270 +**See an more in-depth explanation of state management [here](./documentation/en_US/state_management.md). There you will see more examples and also the difference between the simple state manager and the reactive state manager**
  271 +
  272 +You will get a good idea of GetX power.
  273 +
  274 +## Route management
  275 +
  276 +If you are going to use routes/snackbars/dialogs/bottomsheets without context, GetX is excellent for you too, just see it:
  277 +
  278 +Add "Get" before your MaterialApp, turning it into GetMaterialApp
  279 +
  280 +```dart
  281 +GetMaterialApp( // Before: MaterialApp(
  282 + home: MyHome(),
  283 +)
  284 +```
  285 +
  286 +Navigate to a new screen:
  287 +
  288 +```dart
  289 +
  290 +Get.to(NextScreen());
  291 +```
  292 +
  293 +Navigate to new screen with name. See more details on named routes [here](./documentation/en_US/route_management.md#navigation-with-named-routes)
  294 +
  295 +```dart
  296 +
  297 +Get.toNamed('/details');
  298 +```
  299 +
  300 +To close snackbars, dialogs, bottomsheets, or anything you would normally close with Navigator.pop(context);
  301 +
  302 +```dart
  303 +Get.back();
  304 +```
  305 +
  306 +To go to the next screen and no option to go back to the previous screen (for use in SplashScreens, login screens, etc.)
  307 +
  308 +```dart
  309 +Get.off(NextScreen());
  310 +```
  311 +
  312 +To go to the next screen and cancel all previous routes (useful in shopping carts, polls, and tests)
  313 +
  314 +```dart
  315 +Get.offAll(NextScreen());
  316 +```
  317 +
  318 +Noticed that you didn't have to use context to do any of these things? That's one of the biggest advantages of using Get route management. With this, you can execute all these methods from within your controller class, without worries.
  319 +
  320 +### More details about route management
  321 +
  322 +**Get works with named routes and also offers lower-level control over your routes! There is in-depth documentation [here](./documentation/en_US/route_management.md)**
  323 +
  324 +## Dependency management
  325 +
  326 +Get has a simple and powerful dependency manager that allows you to retrieve the same class as your Bloc or Controller with just 1 lines of code, no Provider context, no inheritedWidget:
  327 +
  328 +```dart
  329 +Controller controller = Get.put(Controller()); // Rather Controller controller = Controller();
  330 +```
  331 +
  332 +- Note: If you are using Get's State Manager, pay more attention to the bindings API, which will make it easier to connect your view to your controller.
  333 +
  334 +Instead of instantiating your class within the class you are using, you are instantiating it within the Get instance, which will make it available throughout your App.
  335 +So you can use your controller (or class Bloc) normally
  336 +
  337 +**Tip:** Get dependency management is decoupled from other parts of the package, so if for example, your app is already using a state manager (any one, it doesn't matter), you don't need to rewrite it all, you can use this dependency injection with no problems at all
  338 +
  339 +```dart
  340 +controller.fetchApi();
  341 +```
  342 +
  343 +Imagine that you have navigated through numerous routes, and you need data that was left behind in your controller, you would need a state manager combined with the Provider or Get_it, correct? Not with Get. You just need to ask Get to "find" for your controller, you don't need any additional dependencies:
  344 +
  345 +```dart
  346 +Controller controller = Get.find();
  347 +//Yes, it looks like Magic, Get will find your controller, and will deliver it to you. You can have 1 million controllers instantiated, Get will always give you the right controller.
  348 +```
  349 +
  350 +And then you will be able to recover your controller data that was obtained back there:
  351 +
  352 +```dart
  353 +Text(controller.textFromApi);
  354 +```
  355 +
  356 +### More details about dependency management
  357 +
  358 +**See a more in-depth explanation of dependency management [here](./documentation/en_US/dependency_management.md)**
  359 +
  360 +# Utils
  361 +
  362 +## Internationalization
  363 +
  364 +### Translations
  365 +
  366 +Translations are kept as a simple key-value dictionary map.
  367 +To add custom translations, create a class and extend `Translations`.
  368 +
  369 +```dart
  370 +import 'package:get/get.dart';
  371 +
  372 +class Messages extends Translations {
  373 + @override
  374 + Map<String, Map<String, String>> get keys => {
  375 + 'en_US': {
  376 + 'hello': 'Hello World',
  377 + },
  378 + 'de_DE': {
  379 + 'hello': 'Hallo Welt',
  380 + }
  381 + };
  382 +}
  383 +```
  384 +
  385 +#### Using translations
  386 +
  387 +Just append `.tr` to the specified key and it will be translated, using the current value of `Get.locale` and `Get.fallbackLocale`.
  388 +
  389 +```dart
  390 +Text('title'.tr);
  391 +```
  392 +
  393 +#### Using translation with singular and plural
  394 +
  395 +```dart
  396 +var products = [];
  397 +Text('singularKey'.trPlural('pluralKey', products.length, Args));
  398 +```
  399 +
  400 +#### Using translation with parameters
  401 +
  402 +```dart
  403 +import 'package:get/get.dart';
  404 +
  405 +
  406 +Map<String, Map<String, String>> get keys => {
  407 + 'en_US': {
  408 + 'logged_in': 'logged in as @name with email @email',
  409 + },
  410 + 'es_ES': {
  411 + 'logged_in': 'iniciado sesión como @name con e-mail @email',
  412 + }
  413 +};
  414 +
  415 +Text('logged_in'.trParams({
  416 + 'name': 'Jhon',
  417 + 'email': 'jhon@example.com'
  418 + }));
  419 +```
  420 +
  421 +### Locales
  422 +
  423 +Pass parameters to `GetMaterialApp` to define the locale and translations.
  424 +
  425 +```dart
  426 +return GetMaterialApp(
  427 + translations: Messages(), // your translations
  428 + locale: Locale('en', 'US'), // translations will be displayed in that locale
  429 + fallbackLocale: Locale('en', 'UK'), // specify the fallback locale in case an invalid locale is selected.
  430 +);
  431 +```
  432 +
  433 +#### Change locale
  434 +
  435 +Call `Get.updateLocale(locale)` to update the locale. Translations then automatically use the new locale.
  436 +
  437 +```dart
  438 +var locale = Locale('en', 'US');
  439 +Get.updateLocale(locale);
  440 +```
  441 +
  442 +#### System locale
  443 +
  444 +To read the system locale, you could use `Get.deviceLocale`.
  445 +
  446 +```dart
  447 +return GetMaterialApp(
  448 + locale: Get.deviceLocale,
  449 +);
  450 +```
  451 +
  452 +## Change Theme
  453 +
  454 +Please do not use any higher level widget than `GetMaterialApp` in order to update it. This can trigger duplicate keys. A lot of people are used to the prehistoric approach of creating a "ThemeProvider" widget just to change the theme of your app, and this is definitely NOT necessary with **GetX™**.
  455 +
  456 +You can create your custom theme and simply add it within `Get.changeTheme` without any boilerplate for that:
  457 +
  458 +```dart
  459 +Get.changeTheme(ThemeData.light());
  460 +```
  461 +
  462 +If you want to create something like a button that changes the Theme in `onTap`, you can combine two **GetX™** APIs for that:
  463 +
  464 +- The api that checks if the dark `Theme` is being used.
  465 +- And the `Theme` Change API, you can just put this within an `onPressed`:
  466 +
  467 +```dart
  468 +Get.changeTheme(Get.isDarkMode? ThemeData.light(): ThemeData.dark());
  469 +```
  470 +
  471 +When `.darkmode` is activated, it will switch to the _light theme_, and when the _light theme_ becomes active, it will change to _dark theme_.
  472 +
  473 +## GetConnect
  474 +
  475 +GetConnect is an easy way to communicate from your back to your front with http or websockets
  476 +
  477 +### Default configuration
  478 +
  479 +You can simply extend GetConnect and use the GET/POST/PUT/DELETE/SOCKET methods to communicate with your Rest API or websockets.
  480 +
  481 +```dart
  482 +class UserProvider extends GetConnect {
  483 + // Get request
  484 + Future<Response> getUser(int id) => get('http://youapi/users/$id');
  485 + // Post request
  486 + Future<Response> postUser(Map data) => post('http://youapi/users', body: data);
  487 + // Post request with File
  488 + Future<Response<CasesModel>> postCases(List<int> image) {
  489 + final form = FormData({
  490 + 'file': MultipartFile(image, filename: 'avatar.png'),
  491 + 'otherFile': MultipartFile(image, filename: 'cover.png'),
  492 + });
  493 + return post('http://youapi/users/upload', form);
  494 + }
  495 +
  496 + GetSocket userMessages() {
  497 + return socket('https://yourapi/users/socket');
  498 + }
  499 +}
  500 +```
  501 +
  502 +### Custom configuration
  503 +
  504 +GetConnect is highly customizable You can define base Url, as answer modifiers, as Requests modifiers, define an authenticator, and even the number of attempts in which it will try to authenticate itself, in addition to giving the possibility to define a standard decoder that will transform all your requests into your Models without any additional configuration.
  505 +
  506 +```dart
  507 +class HomeProvider extends GetConnect {
  508 + @override
  509 + void onInit() {
  510 + // All request will pass to jsonEncode so CasesModel.fromJson()
  511 + httpClient.defaultDecoder = CasesModel.fromJson;
  512 + httpClient.baseUrl = 'https://api.covid19api.com';
  513 + // baseUrl = 'https://api.covid19api.com'; // It define baseUrl to
  514 + // Http and websockets if used with no [httpClient] instance
  515 +
  516 + // It's will attach 'apikey' property on header from all requests
  517 + httpClient.addRequestModifier((request) {
  518 + request.headers['apikey'] = '12345678';
  519 + return request;
  520 + });
  521 +
  522 + // Even if the server sends data from the country "Brazil",
  523 + // it will never be displayed to users, because you remove
  524 + // that data from the response, even before the response is delivered
  525 + httpClient.addResponseModifier<CasesModel>((request, response) {
  526 + CasesModel model = response.body;
  527 + if (model.countries.contains('Brazil')) {
  528 + model.countries.remove('Brazilll');
  529 + }
  530 + });
  531 +
  532 + httpClient.addAuthenticator((request) async {
  533 + final response = await get("http://yourapi/token");
  534 + final token = response.body['token'];
  535 + // Set the header
  536 + request.headers['Authorization'] = "$token";
  537 + return request;
  538 + });
  539 +
  540 + //Autenticator will be called 3 times if HttpStatus is
  541 + //HttpStatus.unauthorized
  542 + httpClient.maxAuthRetries = 3;
  543 + }
  544 + }
  545 +
  546 + @override
  547 + Future<Response<CasesModel>> getCases(String path) => get(path);
  548 +}
  549 +```
  550 +
  551 +## GetPage Middleware
  552 +
  553 +The GetPage has now new property that takes a list of GetMiddleWare and run them in the specific order.
  554 +
  555 +**Note**: When GetPage has a Middlewares, all the children of this page will have the same middlewares automatically.
  556 +
  557 +### Priority
  558 +
  559 +The Order of the Middlewares to run can be set by the priority in the GetMiddleware.
  560 +
  561 +```dart
  562 +final middlewares = [
  563 + GetMiddleware(priority: 2),
  564 + GetMiddleware(priority: 5),
  565 + GetMiddleware(priority: 4),
  566 + GetMiddleware(priority: -8),
  567 +];
  568 +```
  569 +
  570 +those middlewares will be run in this order **-8 => 2 => 4 => 5**
  571 +
  572 +### Redirect
  573 +
  574 +This function will be called when the page of the called route is being searched for. It takes RouteSettings as a result to redirect to. Or give it null and there will be no redirecting.
  575 +
  576 +```dart
  577 +RouteSettings redirect(String route) {
  578 + final authService = Get.find<AuthService>();
  579 + return authService.authed.value ? null : RouteSettings(name: '/login')
  580 +}
  581 +```
  582 +
  583 +### onPageCalled
  584 +
  585 +This function will be called when this Page is called before anything created
  586 +you can use it to change something about the page or give it new page
  587 +
  588 +```dart
  589 +GetPage onPageCalled(GetPage page) {
  590 + final authService = Get.find<AuthService>();
  591 + return page.copyWith(title: 'Welcome ${authService.UserName}');
  592 +}
  593 +```
  594 +
  595 +### OnBindingsStart
  596 +
  597 +This function will be called right before the Bindings are initialize.
  598 +Here you can change Bindings for this page.
  599 +
  600 +```dart
  601 +List<Bindings> onBindingsStart(List<Bindings> bindings) {
  602 + final authService = Get.find<AuthService>();
  603 + if (authService.isAdmin) {
  604 + bindings.add(AdminBinding());
  605 + }
  606 + return bindings;
  607 +}
  608 +```
  609 +
  610 +### OnPageBuildStart
  611 +
  612 +This function will be called right after the Bindings are initialize.
  613 +Here you can do something after that you created the bindings and before creating the page widget.
  614 +
  615 +```dart
  616 +GetPageBuilder onPageBuildStart(GetPageBuilder page) {
  617 + print('bindings are ready');
  618 + return page;
  619 +}
  620 +```
  621 +
  622 +### OnPageBuilt
  623 +
  624 +This function will be called right after the GetPage.page function is called and will give you the result of the function. and take the widget that will be showed.
  625 +
  626 +### OnPageDispose
  627 +
  628 +This function will be called right after disposing all the related objects (Controllers, views, ...) of the page.
  629 +
  630 +## Other Advanced APIs
  631 +
  632 +```dart
  633 +// give the current args from currentScreen
  634 +Get.arguments
  635 +
  636 +// give name of previous route
  637 +Get.previousRoute
  638 +
  639 +// give the raw route to access for example, rawRoute.isFirst()
  640 +Get.rawRoute
  641 +
  642 +// give access to Routing API from GetObserver
  643 +Get.routing
  644 +
  645 +// check if snackbar is open
  646 +Get.isSnackbarOpen
  647 +
  648 +// check if dialog is open
  649 +Get.isDialogOpen
  650 +
  651 +// check if bottomsheet is open
  652 +Get.isBottomSheetOpen
  653 +
  654 +// remove one route.
  655 +Get.removeRoute()
  656 +
  657 +// back repeatedly until the predicate returns true.
  658 +Get.until()
  659 +
  660 +// go to next route and remove all the previous routes until the predicate returns true.
  661 +Get.offUntil()
  662 +
  663 +// go to next named route and remove all the previous routes until the predicate returns true.
  664 +Get.offNamedUntil()
  665 +
  666 +//Check in what platform the app is running
  667 +GetPlatform.isAndroid
  668 +GetPlatform.isIOS
  669 +GetPlatform.isMacOS
  670 +GetPlatform.isWindows
  671 +GetPlatform.isLinux
  672 +GetPlatform.isFuchsia
  673 +
  674 +//Check the device type
  675 +GetPlatform.isMobile
  676 +GetPlatform.isDesktop
  677 +//All platforms are supported independently in web!
  678 +//You can tell if you are running inside a browser
  679 +//on Windows, iOS, OSX, Android, etc.
  680 +GetPlatform.isWeb
  681 +
  682 +
  683 +// Equivalent to : MediaQuery.of(context).size.height,
  684 +// but immutable.
  685 +Get.height
  686 +Get.width
  687 +
  688 +// Gives the current context of the Navigator.
  689 +Get.context
  690 +
  691 +// Gives the context of the snackbar/dialog/bottomsheet in the foreground, anywhere in your code.
  692 +Get.contextOverlay
  693 +
  694 +// Note: the following methods are extensions on context. Since you
  695 +// have access to context in any place of your UI, you can use it anywhere in the UI code
  696 +
  697 +// If you need a changeable height/width (like Desktop or browser windows that can be scaled) you will need to use context.
  698 +context.width
  699 +context.height
  700 +
  701 +// Gives you the power to define half the screen, a third of it and so on.
  702 +// Useful for responsive applications.
  703 +// param dividedBy (double) optional - default: 1
  704 +// param reducedBy (double) optional - default: 0
  705 +context.heightTransformer()
  706 +context.widthTransformer()
  707 +
  708 +/// Similar to MediaQuery.of(context).size
  709 +context.mediaQuerySize()
  710 +
  711 +/// Similar to MediaQuery.of(context).padding
  712 +context.mediaQueryPadding()
  713 +
  714 +/// Similar to MediaQuery.of(context).viewPadding
  715 +context.mediaQueryViewPadding()
  716 +
  717 +/// Similar to MediaQuery.of(context).viewInsets;
  718 +context.mediaQueryViewInsets()
  719 +
  720 +/// Similar to MediaQuery.of(context).orientation;
  721 +context.orientation()
  722 +
  723 +/// Check if device is on landscape mode
  724 +context.isLandscape()
  725 +
  726 +/// Check if device is on portrait mode
  727 +context.isPortrait()
  728 +
  729 +/// Similar to MediaQuery.of(context).devicePixelRatio;
  730 +context.devicePixelRatio()
  731 +
  732 +/// Similar to MediaQuery.of(context).textScaleFactor;
  733 +context.textScaleFactor()
  734 +
  735 +/// Get the shortestSide from screen
  736 +context.mediaQueryShortestSide()
  737 +
  738 +/// True if width be larger than 800
  739 +context.showNavbar()
  740 +
  741 +/// True if the shortestSide is smaller than 600p
  742 +context.isPhone()
  743 +
  744 +/// True if the shortestSide is largest than 600p
  745 +context.isSmallTablet()
  746 +
  747 +/// True if the shortestSide is largest than 720p
  748 +context.isLargeTablet()
  749 +
  750 +/// True if the current device is Tablet
  751 +context.isTablet()
  752 +
  753 +/// Returns a value<T> according to the screen size
  754 +/// can give value for:
  755 +/// watch: if the shortestSide is smaller than 300
  756 +/// mobile: if the shortestSide is smaller than 600
  757 +/// tablet: if the shortestSide is smaller than 1200
  758 +/// desktop: if width is largest than 1200
  759 +context.responsiveValue<T>()
  760 +```
  761 +
  762 +### Optional Global Settings and Manual configurations
  763 +
  764 +GetMaterialApp configures everything for you, but if you want to configure Get manually.
  765 +
  766 +```dart
  767 +MaterialApp(
  768 + navigatorKey: Get.key,
  769 + navigatorObservers: [GetObserver()],
  770 +);
  771 +```
  772 +
  773 +You will also be able to use your own Middleware within `GetObserver`, this will not influence anything.
  774 +
  775 +```dart
  776 +MaterialApp(
  777 + navigatorKey: Get.key,
  778 + navigatorObservers: [
  779 + GetObserver(MiddleWare.observer) // Here
  780 + ],
  781 +);
  782 +```
  783 +
  784 +You can create _Global Settings_ for `Get`. Just add `Get.config` to your code before pushing any route.
  785 +Or do it directly in your `GetMaterialApp`
  786 +
  787 +```dart
  788 +GetMaterialApp(
  789 + enableLog: true,
  790 + defaultTransition: Transition.fade,
  791 + opaqueRoute: Get.isOpaqueRouteDefault,
  792 + popGesture: Get.isPopGestureEnable,
  793 + transitionDuration: Get.defaultDurationTransition,
  794 + defaultGlobalState: Get.defaultGlobalState,
  795 +);
  796 +
  797 +Get.config(
  798 + enableLog = true,
  799 + defaultPopGesture = true,
  800 + defaultTransition = Transitions.cupertino
  801 +)
  802 +```
  803 +
  804 +You can optionally redirect all the logging messages from `Get`.
  805 +If you want to use your own, favourite logging package,
  806 +and want to capture the logs there:
  807 +
  808 +```dart
  809 +GetMaterialApp(
  810 + enableLog: true,
  811 + logWriterCallback: localLogWriter,
  812 +);
  813 +
  814 +void localLogWriter(String text, {bool isError = false}) {
  815 + // pass the message to your favourite logging package here
  816 + // please note that even if enableLog: false log messages will be pushed in this callback
  817 + // you get check the flag if you want through GetConfig.isLogEnable
  818 +}
  819 +
  820 +```
  821 +
  822 +### Local State Widgets
  823 +
  824 +These Widgets allows you to manage a single value, and keep the state ephemeral and locally.
  825 +We have flavours for Reactive and Simple.
  826 +For instance, you might use them to toggle obscureText in a `TextField`, maybe create a custom
  827 +Expandable Panel, or maybe modify the current index in `BottomNavigationBar` while changing the content
  828 +of the body in a `Scaffold`.
  829 +
  830 +#### ValueBuilder
  831 +
  832 +A simplification of `StatefulWidget` that works with a `.setState` callback that takes the updated value.
  833 +
  834 +```dart
  835 +ValueBuilder<bool>(
  836 + initialValue: false,
  837 + builder: (value, updateFn) => Switch(
  838 + value: value,
  839 + onChanged: updateFn, // same signature! you could use ( newValue ) => updateFn( newValue )
  840 + ),
  841 + // if you need to call something outside the builder method.
  842 + onUpdate: (value) => print("Value updated: $value"),
  843 + onDispose: () => print("Widget unmounted"),
  844 +),
  845 +```
  846 +
  847 +#### ObxValue
  848 +
  849 +Similar to [`ValueBuilder`](#valuebuilder), but this is the Reactive version, you pass a Rx instance (remember the magical .obs?) and
  850 +updates automatically... isn't it awesome?
  851 +
  852 +```dart
  853 +ObxValue((data) => Switch(
  854 + value: data.value,
  855 + onChanged: data, // Rx has a _callable_ function! You could use (flag) => data.value = flag,
  856 + ),
  857 + false.obs,
  858 +),
  859 +```
  860 +
  861 +## Useful tips
  862 +
  863 +`.obs`ervables (also known as _Rx_ Types) have a wide variety of internal methods and operators.
  864 +
  865 +> Is very common to _believe_ that a property with `.obs` **IS** the actual value... but make no mistake!
  866 +> We avoid the Type declaration of the variable, because Dart's compiler is smart enough, and the code
  867 +> looks cleaner, but:
  868 +
  869 +```dart
  870 +var message = 'Hello world'.obs;
  871 +print( 'Message "$message" has Type ${message.runtimeType}');
  872 +```
  873 +
  874 +Even if `message` _prints_ the actual String value, the Type is **RxString**!
  875 +
  876 +So, you can't do `message.substring( 0, 4 )`.
  877 +You have to access the real `value` inside the _observable_:
  878 +The most "used way" is `.value`, but, did you know that you can also use...
  879 +
  880 +```dart
  881 +final name = 'GetX'.obs;
  882 +// only "updates" the stream, if the value is different from the current one.
  883 +name.value = 'Hey';
  884 +
  885 +// All Rx properties are "callable" and returns the new value.
  886 +// but this approach does not accepts `null`, the UI will not rebuild.
  887 +name('Hello');
  888 +
  889 +// is like a getter, prints 'Hello'.
  890 +name() ;
  891 +
  892 +/// numbers:
  893 +
  894 +final count = 0.obs;
  895 +
  896 +// You can use all non mutable operations from num primitives!
  897 +count + 1;
  898 +
  899 +// Watch out! this is only valid if `count` is not final, but var
  900 +count += 1;
  901 +
  902 +// You can also compare against values:
  903 +count > 2;
  904 +
  905 +/// booleans:
  906 +
  907 +final flag = false.obs;
  908 +
  909 +// switches the value between true/false
  910 +flag.toggle();
  911 +
  912 +
  913 +/// all types:
  914 +
  915 +// Sets the `value` to null.
  916 +flag.nil();
  917 +
  918 +// All toString(), toJson() operations are passed down to the `value`
  919 +print( count ); // calls `toString()` inside for RxInt
  920 +
  921 +final abc = [0,1,2].obs;
  922 +// Converts the value to a json Array, prints RxList
  923 +// Json is supported by all Rx types!
  924 +print('json: ${jsonEncode(abc)}, type: ${abc.runtimeType}');
  925 +
  926 +// RxMap, RxList and RxSet are special Rx types, that extends their native types.
  927 +// but you can work with a List as a regular list, although is reactive!
  928 +abc.add(12); // pushes 12 to the list, and UPDATES the stream.
  929 +abc[3]; // like Lists, reads the index 3.
  930 +
  931 +
  932 +// equality works with the Rx and the value, but hashCode is always taken from the value
  933 +final number = 12.obs;
  934 +print( number == 12 ); // prints > true
  935 +
  936 +/// Custom Rx Models:
  937 +
  938 +// toJson(), toString() are deferred to the child, so you can implement override on them, and print() the observable directly.
  939 +
  940 +class User {
  941 + String name, last;
  942 + int age;
  943 + User({this.name, this.last, this.age});
  944 +
  945 + @override
  946 + String toString() => '$name $last, $age years old';
  947 +}
  948 +
  949 +final user = User(name: 'John', last: 'Doe', age: 33).obs;
  950 +
  951 +// `user` is "reactive", but the properties inside ARE NOT!
  952 +// So, if we change some variable inside of it...
  953 +user.value.name = 'Roi';
  954 +// The widget will not rebuild!,
  955 +// `Rx` don't have any clue when you change something inside user.
  956 +// So, for custom classes, we need to manually "notify" the change.
  957 +user.refresh();
  958 +
  959 +// or we can use the `update()` method!
  960 +user.update((value){
  961 + value.name='Roi';
  962 +});
  963 +
  964 +print( user );
  965 +```
  966 +
  967 +## StateMixin
  968 +
  969 +Another way to handle your `UI` state is use the `StateMixin<T>` .
  970 +To implement it, use the `with` to add the `StateMixin<T>`
  971 +to your controller which allows a T model.
  972 +
  973 +```dart
  974 +class Controller extends GetController with StateMixin<User>{}
  975 +```
  976 +
  977 +The `change()` method change the State whenever we want.
  978 +Just pass the data and the status in this way:
  979 +
  980 +```dart
  981 +change(data, status: RxStatus.success());
  982 +```
  983 +
  984 +RxStatus allow these status:
  985 +
  986 +```dart
  987 +RxStatus.loading();
  988 +RxStatus.success();
  989 +RxStatus.empty();
  990 +RxStatus.error('message');
  991 +```
  992 +
  993 +To represent it in the UI, use:
  994 +
  995 +```dart
  996 +class OtherClass extends GetView<Controller> {
  997 + @override
  998 + Widget build(BuildContext context) {
  999 + return Scaffold(
  1000 +
  1001 + body: controller.obx(
  1002 + (state)=>Text(state.name),
  1003 +
  1004 + // here you can put your custom loading indicator, but
  1005 + // by default would be Center(child:CircularProgressIndicator())
  1006 + onLoading: CustomLoadingIndicator(),
  1007 + onEmpty: Text('No data found'),
  1008 +
  1009 + // here also you can set your own error widget, but by
  1010 + // default will be an Center(child:Text(error))
  1011 + onError: (error)=>Text(error),
  1012 + ),
  1013 + );
  1014 +}
  1015 +```
  1016 +
  1017 +#### GetView
  1018 +
  1019 +I love this Widget, is so simple, yet, so useful!
  1020 +
  1021 +Is a `const Stateless` Widget that has a getter `controller` for a registered `Controller`, that's all.
  1022 +
  1023 +```dart
  1024 + class AwesomeController extends GetController {
  1025 + final String title = 'My Awesome View';
  1026 + }
  1027 +
  1028 + // ALWAYS remember to pass the `Type` you used to register your controller!
  1029 + class AwesomeView extends GetView<AwesomeController> {
  1030 + @override
  1031 + Widget build(BuildContext context) {
  1032 + return Container(
  1033 + padding: EdgeInsets.all(20),
  1034 + child: Text(controller.title), // just call `controller.something`
  1035 + );
  1036 + }
  1037 + }
  1038 +```
  1039 +
  1040 +#### GetResponsiveView
  1041 +
  1042 +Extend this widget to build responsive view.
  1043 +this widget contains the `screen` property that have all
  1044 +information about the screen size and type.
  1045 +
  1046 +##### How to use it
  1047 +
  1048 +You have two options to build it.
  1049 +
  1050 +- with `builder` method you return the widget to build.
  1051 +- with methods `desktop`, `tablet`,`phone`, `watch`. the specific
  1052 + method will be built when the screen type matches the method
  1053 + when the screen is [ScreenType.Tablet] the `tablet` method
  1054 + will be exuded and so on.
  1055 + **Note:** If you use this method please set the property `alwaysUseBuilder` to `false`
  1056 +
  1057 +With `settings` property you can set the width limit for the screen types.
  1058 +
  1059 +![example](https://github.com/SchabanBo/get_page_example/blob/master/docs/Example.gif?raw=true)
  1060 +Code to this screen
  1061 +[code](https://github.com/SchabanBo/get_page_example/blob/master/lib/pages/responsive_example/responsive_view.dart)
  1062 +
  1063 +#### GetWidget
  1064 +
  1065 +Most people have no idea about this Widget, or totally confuse the usage of it.
  1066 +The use case is very rare, but very specific: It `caches` a Controller.
  1067 +Because of the _cache_, can't be a `const Stateless`.
  1068 +
  1069 +> So, when do you need to "cache" a Controller?
  1070 +
  1071 +If you use, another "not so common" feature of **GetX**: `Get.create()`.
  1072 +
  1073 +`Get.create(()=>Controller())` will generate a new `Controller` each time you call
  1074 +`Get.find<Controller>()`,
  1075 +
  1076 +That's where `GetWidget` shines... as you can use it, for example,
  1077 +to keep a list of Todo items. So, if the widget gets "rebuilt", it will keep the same controller instance.
  1078 +
  1079 +#### GetxService
  1080 +
  1081 +This class is like a `GetxController`, it shares the same lifecycle ( `onInit()`, `onReady()`, `onClose()`).
  1082 +But has no "logic" inside of it. It just notifies **GetX** Dependency Injection system, that this subclass
  1083 +**can not** be removed from memory.
  1084 +
  1085 +So is super useful to keep your "Services" always reachable and active with `Get.find()`. Like:
  1086 +`ApiService`, `StorageService`, `CacheService`.
  1087 +
  1088 +```dart
  1089 +Future<void> main() async {
  1090 + await initServices(); /// AWAIT SERVICES INITIALIZATION.
  1091 + runApp(SomeApp());
  1092 +}
  1093 +
  1094 +/// Is a smart move to make your Services intiialize before you run the Flutter app.
  1095 +/// as you can control the execution flow (maybe you need to load some Theme configuration,
  1096 +/// apiKey, language defined by the User... so load SettingService before running ApiService.
  1097 +/// so GetMaterialApp() doesnt have to rebuild, and takes the values directly.
  1098 +void initServices() async {
  1099 + print('starting services ...');
  1100 + /// Here is where you put get_storage, hive, shared_pref initialization.
  1101 + /// or moor connection, or whatever that's async.
  1102 + await Get.putAsync(() => DbService().init());
  1103 + await Get.putAsync(SettingsService()).init();
  1104 + print('All services started...');
  1105 +}
  1106 +
  1107 +class DbService extends GetxService {
  1108 + Future<DbService> init() async {
  1109 + print('$runtimeType delays 2 sec');
  1110 + await 2.delay();
  1111 + print('$runtimeType ready!');
  1112 + return this;
  1113 + }
  1114 +}
  1115 +
  1116 +class SettingsService extends GetxService {
  1117 + void init() async {
  1118 + print('$runtimeType delays 1 sec');
  1119 + await 1.delay();
  1120 + print('$runtimeType ready!');
  1121 + }
  1122 +}
  1123 +
  1124 +```
  1125 +
  1126 +The only way to actually delete a `GetxService`, is with `Get.reset()` which is like a
  1127 +"Hot Reboot" of your app. So remember, if you need absolute persistence of a class instance during the
  1128 +lifetime of your app, use `GetxService`.
  1129 +
  1130 +### Tests
  1131 +
  1132 +You can test your controllers like any other class, including their lifecycles:
  1133 +
  1134 +```dart
  1135 +class Controller extends GetxController {
  1136 + @override
  1137 + void onInit() {
  1138 + super.onInit();
  1139 + //Change value to name2
  1140 + name.value = 'name2';
  1141 + }
  1142 +
  1143 + @override
  1144 + void onClose() {
  1145 + name.value = '';
  1146 + super.onClose();
  1147 + }
  1148 +
  1149 + final name = 'name1'.obs;
  1150 +
  1151 + void changeName() => name.value = 'name3';
  1152 +}
  1153 +
  1154 +void main() {
  1155 + test('''
  1156 +Test the state of the reactive variable "name" across all of its lifecycles''',
  1157 + () {
  1158 + /// You can test the controller without the lifecycle,
  1159 + /// but it's not recommended unless you're not using
  1160 + /// GetX dependency injection
  1161 + final controller = Controller();
  1162 + expect(controller.name.value, 'name1');
  1163 +
  1164 + /// If you are using it, you can test everything,
  1165 + /// including the state of the application after each lifecycle.
  1166 + Get.put(controller); // onInit was called
  1167 + expect(controller.name.value, 'name2');
  1168 +
  1169 + /// Test your functions
  1170 + controller.changeName();
  1171 + expect(controller.name.value, 'name3');
  1172 +
  1173 + /// onClose was called
  1174 + Get.delete<Controller>();
  1175 +
  1176 + expect(controller.name.value, '');
  1177 + });
  1178 +}
  1179 +```
  1180 +
  1181 +#### Tips
  1182 +
  1183 +##### Mockito or mocktail
  1184 +
  1185 +If you need to mock your GetxController/GetxService, you should extend GetxController, and mixin it with Mock, that way
  1186 +
  1187 +```dart
  1188 +class NotificationServiceMock extends GetxService with Mock implements NotificationService {}
  1189 +```
  1190 +
  1191 +##### Using Get.reset()
  1192 +
  1193 +If you are testing widgets, or test groups, use Get.reset at the end of your test or in tearDown to reset all settings from your previous test.
  1194 +
  1195 +##### Get.testMode
  1196 +
  1197 +if you are using your navigation in your controllers, use `Get.testMode = true` at the beginning of your main.
  1198 +
  1199 +# Breaking changes from 2.0
  1200 +
  1201 +1- Rx types:
  1202 +
  1203 +| Before | After |
  1204 +| ------- | ---------- |
  1205 +| StringX | `RxString` |
  1206 +| IntX | `RxInt` |
  1207 +| MapX | `RxMap` |
  1208 +| ListX | `RxList` |
  1209 +| NumX | `RxNum` |
  1210 +| DoubleX | `RxDouble` |
  1211 +
  1212 +RxController and GetBuilder now have merged, you no longer need to memorize which controller you want to use, just use GetxController, it will work for simple state management and for reactive as well.
  1213 +
  1214 +2- NamedRoutes
  1215 +Before:
  1216 +
  1217 +```dart
  1218 +GetMaterialApp(
  1219 + namedRoutes: {
  1220 + '/': GetRoute(page: Home()),
  1221 + }
  1222 +)
  1223 +```
  1224 +
  1225 +Now:
  1226 +
  1227 +```dart
  1228 +GetMaterialApp(
  1229 + getPages: [
  1230 + GetPage(name: '/', page: () => Home()),
  1231 + ]
  1232 +)
  1233 +```
  1234 +
  1235 +Why this change?
  1236 +Often, it may be necessary to decide which page will be displayed from a parameter, or a login token, the previous approach was inflexible, as it did not allow this.
  1237 +Inserting the page into a function has significantly reduced the RAM consumption, since the routes will not be allocated in memory since the app was started, and it also allowed to do this type of approach:
  1238 +
  1239 +```dart
  1240 +
  1241 +GetStorage box = GetStorage();
  1242 +
  1243 +GetMaterialApp(
  1244 + getPages: [
  1245 + GetPage(name: '/', page:(){
  1246 + return box.hasData('token') ? Home() : Login();
  1247 + })
  1248 + ]
  1249 +)
  1250 +```
  1251 +
  1252 +# Why Getx?
  1253 +
  1254 +1- Many times after a Flutter update, many of your packages will break. Sometimes compilation errors happen, errors often appear that there are still no answers about, and the developer needs to know where the error came from, track the error, only then try to open an issue in the corresponding repository, and see its problem solved. Get centralizes the main resources for development (State, dependency and route management), allowing you to add a single package to your pubspec, and start working. After a Flutter update, the only thing you need to do is update the Get dependency, and get to work. Get also resolves compatibility issues. How many times a version of a package is not compatible with the version of another, because one uses a dependency in one version, and the other in another version? This is also not a concern using Get, as everything is in the same package and is fully compatible.
  1255 +
  1256 +2- Flutter is easy, Flutter is incredible, but Flutter still has some boilerplate that may be unwanted for most developers, such as `Navigator.of(context).push (context, builder [...]`. Get simplifies development. Instead of writing 8 lines of code to just call a route, you can just do it: `Get.to(Home())` and you're done, you'll go to the next page. Dynamic web urls are a really painful thing to do with Flutter currently, and that with GetX is stupidly simple. Managing states in Flutter, and managing dependencies is also something that generates a lot of discussion, as there are hundreds of patterns in the pub. But there is nothing as easy as adding a ".obs" at the end of your variable, and place your widget inside an Obx, and that's it, all updates to that variable will be automatically updated on the screen.
  1257 +
  1258 +3- Ease without worrying about performance. Flutter's performance is already amazing, but imagine that you use a state manager, and a locator to distribute your blocs/stores/controllers/ etc. classes. You will have to manually call the exclusion of that dependency when you don't need it. But have you ever thought of simply using your controller, and when it was no longer being used by anyone, it would simply be deleted from memory? That's what GetX does. With SmartManagement, everything that is not being used is deleted from memory, and you shouldn't have to worry about anything but programming. You will be assured that you are consuming the minimum necessary resources, without even having created a logic for this.
  1259 +
  1260 +4- Actual decoupling. You may have heard the concept "separate the view from the business logic". This is not a peculiarity of BLoC, MVC, MVVM, and any other standard on the market has this concept. However, this concept can often be mitigated in Flutter due to the use of context.
  1261 +If you need context to find an InheritedWidget, you need it in the view, or pass the context by parameter. I particularly find this solution very ugly, and to work in teams we will always have a dependence on View's business logic. Getx is unorthodox with the standard approach, and while it does not completely ban the use of StatefulWidgets, InitState, etc., it always has a similar approach that can be cleaner. Controllers have life cycles, and when you need to make an APIREST request for example, you don't depend on anything in the view. You can use onInit to initiate the http call, and when the data arrives, the variables will be populated. As GetX is fully reactive (really, and works under streams), once the items are filled, all widgets that use that variable will be automatically updated in the view. This allows people with UI expertise to work only with widgets, and not have to send anything to business logic other than user events (like clicking a button), while people working with business logic will be free to create and test the business logic separately.
  1262 +
  1263 +This library will always be updated and implementing new features. Feel free to offer PRs and contribute to them.
  1264 +
  1265 +# Community
  1266 +
  1267 +## Community channels
  1268 +
  1269 +GetX has a highly active and helpful community. If you have questions, or would like any assistance regarding the use of this framework, please join our community channels, your question will be answered more quickly, and it will be the most suitable place. This repository is exclusive for opening issues, and requesting resources, but feel free to be part of GetX Community.
  1270 +
  1271 +| **Slack** | **Discord** | **Telegram** |
  1272 +| :-------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------- |
  1273 +| [![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](https://communityinviter.com/apps/getxworkspace/getx) | [![Discord Shield](https://img.shields.io/discord/722900883784073290.svg?logo=discord)](https://discord.com/invite/9Hpt99N) | [![Telegram](https://img.shields.io/badge/chat-on%20Telegram-blue.svg)](https://t.me/joinchat/PhdbJRmsZNpAqSLJL6bH7g) |
  1274 +
  1275 +## How to contribute
  1276 +
  1277 +_Want to contribute to the project? We will be proud to highlight you as one of our collaborators. Here are some points where you can contribute and make Get (and Flutter) even better._
  1278 +
  1279 +- Helping to translate the readme into other languages.
  1280 +- Adding documentation to the readme (a lot of Get's functions haven't been documented yet).
  1281 +- Write articles or make videos teaching how to use Get (they will be inserted in the Readme and in the future in our Wiki).
  1282 +- Offering PRs for code/tests.
  1283 +- Including new functions.
  1284 +
  1285 +Any contribution is welcome!
  1286 +
  1287 +## Articles and videos
  1288 +
  1289 +- [Flutter Getx EcoSystem package for arabic people](https://www.youtube.com/playlist?list=PLV1fXIAyjeuZ6M8m56zajMUwu4uE3-SL0) - Tutorial by [Pesa Coder](https://github.com/UsamaElgendy).
  1290 +- [Dynamic Themes in 3 lines using GetX™](https://medium.com/swlh/flutter-dynamic-themes-in-3-lines-c3b375f292e3) - Tutorial by [Rod Brown](https://github.com/RodBr).
  1291 +- [Complete GetX™ Navigation](https://www.youtube.com/watch?v=RaqPIoJSTtI) - Route management video by Amateur Coder.
  1292 +- [Complete GetX State Management](https://www.youtube.com/watch?v=CNpXbeI_slw) - State management video by Amateur Coder.
  1293 +- [GetX™ Other Features](https://youtu.be/ttQtlX_Q0eU) - Utils, storage, bindings and other features video by Amateur Coder.
  1294 +- [Firestore User with GetX | Todo App](https://www.youtube.com/watch?v=BiV0DcXgk58) - Video by Amateur Coder.
  1295 +- [Firebase Auth with GetX | Todo App](https://www.youtube.com/watch?v=-H-T_BSgfOE) - Video by Amateur Coder.
  1296 +- [The Flutter GetX™ Ecosystem ~ State Management](https://medium.com/flutter-community/the-flutter-getx-ecosystem-state-management-881c7235511d) - State management by [Aachman Garg](https://github.com/imaachman).
  1297 +- [The Flutter GetX™ Ecosystem ~ Dependency Injection](https://medium.com/flutter-community/the-flutter-getx-ecosystem-dependency-injection-8e763d0ec6b9) - Dependency Injection by [Aachman Garg](https://github.com/imaachman).
  1298 +- [GetX, the all-in-one Flutter package](https://www.youtube.com/watch?v=IYQgtu9TM74) - A brief tutorial covering State Management and Navigation by Thad Carnevalli.
  1299 +- [Build a To-do List App from scratch using Flutter and GetX](https://www.youtube.com/watch?v=EcnqFasHf18) - UI + State Management + Storage video by Thad Carnevalli.
  1300 +- [GetX Flutter Firebase Auth Example](https://medium.com/@jeffmcmorris/getx-flutter-firebase-auth-example-b383c1dd1de2) - Article by Jeff McMorris.
  1301 +- [Flutter State Management with GetX – Complete App](https://www.appwithflutter.com/flutter-state-management-with-getx/) - by App With Flutter.
  1302 +- [Flutter Routing with Animation using Get Package](https://www.appwithflutter.com/flutter-routing-using-get-package/) - by App With Flutter.
  1303 +- [A minimal example on dartpad](https://dartpad.dev/2b3d0d6f9d4e312c5fdbefc414c1727e?) - by [Roi Peker](https://github.com/roipeker)
  1304 +
  1305 +</div>