khangahs

0.0.0.3

Complete the overall translation for GetX Vietnamese
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 - [Local State Widgets](#local-state-widgets) 51 - [Local State Widgets](#local-state-widgets)
52 - [ValueBuilder](#valuebuilder) 52 - [ValueBuilder](#valuebuilder)
53 - [ObxValue](#obxvalue) 53 - [ObxValue](#obxvalue)
54 - - [Useful tips](#useful-tips) 54 + - [Mẹo hữu ích](#useful-tips)
55 - [GetView](#getview) 55 - [GetView](#getview)
56 - [GetResponsiveView](#getresponsiveview) 56 - [GetResponsiveView](#getresponsiveview)
57 - [Hướng dẫn sử dụng trước khi dùng](#how-to-use-it) 57 - [Hướng dẫn sử dụng trước khi dùng](#how-to-use-it)
@@ -810,7 +810,7 @@ ObxValue((data) => Switch( @@ -810,7 +810,7 @@ ObxValue((data) => Switch(
810 ), 810 ),
811 ``` 811 ```
812 812
813 -## Useful tips 813 +## Mẹo hữu ích
814 814
815 `.obs` observable (variable có thể quan sát được) (còn được gọi là loại _Rx_) có nhiều phương thức và toán tử bên trong. 815 `.obs` observable (variable có thể quan sát được) (còn được gọi là loại _Rx_) có nhiều phương thức và toán tử bên trong.
816 816
@@ -819,7 +819,7 @@ ObxValue((data) => Switch( @@ -819,7 +819,7 @@ ObxValue((data) => Switch(
819 > looks cleaner, but: 819 > looks cleaner, but:
820 820
821 ```dart 821 ```dart
822 -var message = 'Hello world'.obs; 822 +var message = 'Xin Chào'.obs;
823 print( 'Message "$message" has Type ${message.runtimeType}'); 823 print( 'Message "$message" has Type ${message.runtimeType}');
824 ``` 824 ```
825 825
@@ -896,11 +896,11 @@ class User { @@ -896,11 +896,11 @@ class User {
896 String toString() => '$name $last, $age years old'; 896 String toString() => '$name $last, $age years old';
897 } 897 }
898 898
899 -final user = User(name: 'John', last: 'Doe', age: 33).obs; 899 +final user = User(name: 'Khang', last: 'Huỳnh', age: 33).obs;
900 900
901 // `user` is "reactive", but the properties inside ARE NOT! 901 // `user` is "reactive", but the properties inside ARE NOT!
902 // So, if we change some variable inside of it... 902 // So, if we change some variable inside of it...
903 -user.value.name = 'Roi'; 903 +user.value.name = 'Kaiser';
904 // The widget will not rebuild!, 904 // The widget will not rebuild!,
905 // `Rx` don't have any clue when you change something inside user. 905 // `Rx` don't have any clue when you change something inside user.
906 // So, for custom classes, we need to manually "notify" the change. 906 // So, for custom classes, we need to manually "notify" the change.
@@ -908,7 +908,7 @@ user.refresh(); @@ -908,7 +908,7 @@ user.refresh();
908 908
909 // or we can use the `update()` method! 909 // or we can use the `update()` method!
910 user.update((value){ 910 user.update((value){
911 - value.name='Roi'; 911 + value.name='Kaiser';
912 }); 912 });
913 913
914 print( user ); 914 print( user );
@@ -1022,7 +1022,7 @@ Nếu sử dụng, bạn sẽ dùng cái này **GetX**: `Get.create()`. @@ -1022,7 +1022,7 @@ Nếu sử dụng, bạn sẽ dùng cái này **GetX**: `Get.create()`.
1022 1022
1023 #### GetxService 1023 #### GetxService
1024 1024
1025 -Class này giống như một `GetxController`, nó chia sẻ cùng một vòng đời (` onInit () `,` onReady () `,` onClose () `). 1025 +Class này giống như một `GetxController`, nó chia sẻ cùng một vòng đời (`onInit ()`,`onReady ()`,`onClose ()`).
1026 Nhưng không có "logic" bên trong của nó. Nó chỉ thông báo cho ** GetX ** Hệ thống Nạp Dependency rằng class con này ** không thể ** bị xóa khỏi bộ nhớ. 1026 Nhưng không có "logic" bên trong của nó. Nó chỉ thông báo cho ** GetX ** Hệ thống Nạp Dependency rằng class con này ** không thể ** bị xóa khỏi bộ nhớ.
1027 1027
1028 Vì vậy, rất hữu ích để giữ cho "Service" của bạn luôn có thể truy cập và hoạt động với `Get.find ()`. Giống: 1028 Vì vậy, rất hữu ích để giữ cho "Service" của bạn luôn có thể truy cập và hoạt động với `Get.find ()`. Giống:
@@ -1066,7 +1066,7 @@ class SettingsService extends GetxService { @@ -1066,7 +1066,7 @@ class SettingsService extends GetxService {
1066 1066
1067 ``` 1067 ```
1068 1068
1069 -Cách duy nhất để thực sự xóa một `GetxService`, là với` Get.reset () `giống như cách thức "Khởi động nóng" ứng dụng của bạn. Vì vậy, hãy nhớ rằng, nếu bạn cần sự tồn tại tuyệt đối của một class trong vòng đời tồn tại của nó trong ứng dụng của bạn, hãy sử dụng `GetxService`. 1069 +Cách duy nhất để thực sự xóa một `GetxService`, là với`Get.reset ()`giống như cách thức "Khởi động nóng" ứng dụng của bạn. Vì vậy, hãy nhớ rằng, nếu bạn cần sự tồn tại tuyệt đối của một class trong vòng đời tồn tại của nó trong ứng dụng của bạn, hãy sử dụng `GetxService`.
1070 1070
1071 # Thay đổi đột phá 2.0 1071 # Thay đổi đột phá 2.0
1072 1072
1 -# Dependency Management  
2 -- [Dependency Management](#dependency-management) 1 +# Quản lý dependency
  2 +- [Quản lý dependency](#dependency-management)
3 - [Instancing methods](#instancing-methods) 3 - [Instancing methods](#instancing-methods)
4 - [Get.put()](#getput) 4 - [Get.put()](#getput)
5 - [Get.lazyPut](#getlazyput) 5 - [Get.lazyPut](#getlazyput)
6 - [Get.putAsync](#getputasync) 6 - [Get.putAsync](#getputasync)
7 - [Get.create](#getcreate) 7 - [Get.create](#getcreate)
8 - - [Using instantiated methods/classes](#using-instantiated-methodsclasses)  
9 - - [Differences between methods](#differences-between-methods) 8 + - [Sử dụng các phương thức / class](#using-instantiated-methodsclasses)
  9 + - [Khác nhau giữa phương thức (methods)](#differences-between-methods)
10 - [Bindings](#bindings) 10 - [Bindings](#bindings)
11 - - [How to use](#how-to-use) 11 + - [Cách sử dụng](#how-to-use)
12 - [BindingsBuilder](#bindingsbuilder) 12 - [BindingsBuilder](#bindingsbuilder)
13 - [SmartManagement](#smartmanagement) 13 - [SmartManagement](#smartmanagement)
14 - - [How to change](#How-to-change) 14 + - [Cách thay đổi](#How-to-change)
15 - [SmartManagement.full](#smartmanagementfull) 15 - [SmartManagement.full](#smartmanagementfull)
16 - [SmartManagement.onlyBuilders](#smartmanagementonlybuilders) 16 - [SmartManagement.onlyBuilders](#smartmanagementonlybuilders)
17 - [SmartManagement.keepFactory](#smartmanagementkeepfactory) 17 - [SmartManagement.keepFactory](#smartmanagementkeepfactory)
18 - - [How bindings work under the hood](#how-bindings-work-under-the-hood)  
19 - - [Notes](#notes) 18 + - [Cách bindings làm việc ngầm](#how-bindings-work-under-the-hood)
  19 + - [Chí ú](#notes)
20 20
21 -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: 21 +Get có một trình quản lý dependency đơn giản và mạnh mẽ cho phép bạn truy xuất cùng một class với Blocs hoặc Controller của bạn chỉ với 1 dòng mã, không có "context", không có InheritedWidget
22 22
23 ```dart 23 ```dart
24 Controller controller = Get.put(Controller()); // Rather Controller controller = Controller(); 24 Controller controller = Get.put(Controller()); // Rather Controller controller = Controller();
25 ``` 25 ```
26 26
27 -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.  
28 -So you can use your controller (or Bloc class) normally 27 +Thay vì khởi tạo class của bạn trong class bạn đang sử dụng, bạn đang khởi tạo nó trong phiên bản Get, điều này sẽ làm cho nó có sẵn trên toàn bộ Ứng dụng của bạn.
  28 +Vì vậy, bạn có thể sử dụng controller (hoặc class Blocs) của mình một cách bình thường
29 29
30 -- Note: If you are using Get's State Manager, pay more attention to the [Bindings](#bindings) api, which will make easier to connect your view to your controller.  
31 -- Note²: Get dependency management is decloupled 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 change that, you can use this dependency injection manager with no problems at all 30 +- Note: Nếu bạn đang sử dụng Get's State Manager, hãy chú ý hơn đến [Bindings](#bindings) api, điều này sẽ giúp kết nối chế độ xem với controller của bạn dễ dàng hơn.
  31 +- Note²: Quản lý state của Get được tách biệt khỏi các phần khác của gói, vì vậy, nếu ví dụ: nếu ứng dụng của bạn đã sử dụng trình quản lý state (bất kỳ cái nào, không quan trọng), bạn không cần phải thay đổi điều đó, bạn có thể sử dụng phần dependency này người quản lý không có vấn đề gì cả
32 32
33 ## Instancing methods 33 ## Instancing methods
34 -The methods and it's configurable parameters are: 34 +Các phương thức và các tham số có thể định cấu hình của nó là:
35 35
36 ### Get.put() 36 ### Get.put()
37 37
38 -The most common way of inserting a dependency. Good for the controllers of your views for example. 38 +Cách phổ biến nhất để chèn một dependency, là một điều tốt cho controller của View của bạn.
39 39
40 ```dart 40 ```dart
41 Get.put<SomeClass>(SomeClass()); 41 Get.put<SomeClass>(SomeClass());
@@ -43,7 +43,7 @@ Get.put<LoginController>(LoginController(), permanent: true); @@ -43,7 +43,7 @@ Get.put<LoginController>(LoginController(), permanent: true);
43 Get.put<ListItemController>(ListItemController, tag: "some unique string"); 43 Get.put<ListItemController>(ListItemController, tag: "some unique string");
44 ``` 44 ```
45 45
46 -This is all options you can set when using put: 46 +Đây là tùy chọn mà bạn có thể đặt lệnh:
47 ```dart 47 ```dart
48 Get.put<S>( 48 Get.put<S>(
49 // mandatory: the class that you want to get to save, like a controller or anything 49 // mandatory: the class that you want to get to save, like a controller or anything
@@ -74,7 +74,7 @@ Get.put<S>( @@ -74,7 +74,7 @@ Get.put<S>(
74 ``` 74 ```
75 75
76 ### Get.lazyPut 76 ### Get.lazyPut
77 -It is possible to lazyLoad a dependency so that it will be instantiated only when is used. Very useful for computational expensive classes or if you want to instantiate several classes in just one place (like in a Bindings class) and you know you will not gonna use that class at that time. 77 +Có thể lazyLoad một dependecy để nó chỉ được khởi tạo khi được sử dụng. Rất hữu ích cho các class ngốn nhiều tài nguyên hoặc nếu bạn muốn khởi tạo một số class chỉ ở một nơi (như trong class Bindings) và bạn biết rằng mình sẽ không sử dụng class đó tại thời điểm nhất định.
78 78
79 ```dart 79 ```dart
80 /// ApiMock will only be called when someone uses Get.find<ApiMock> for the first time 80 /// ApiMock will only be called when someone uses Get.find<ApiMock> for the first time
@@ -92,7 +92,7 @@ Get.lazyPut<FirebaseAuth>( @@ -92,7 +92,7 @@ Get.lazyPut<FirebaseAuth>(
92 Get.lazyPut<Controller>( () => Controller() ) 92 Get.lazyPut<Controller>( () => Controller() )
93 ``` 93 ```
94 94
95 -This is all options you can set when using lazyPut: 95 +Đây là các tùy chọn bạn có thể đặt lệnh:
96 ```dart 96 ```dart
97 Get.lazyPut<S>( 97 Get.lazyPut<S>(
98 // mandatory: a method that will be executed when your class is called for the first time 98 // mandatory: a method that will be executed when your class is called for the first time
@@ -112,7 +112,7 @@ Get.lazyPut<S>( @@ -112,7 +112,7 @@ Get.lazyPut<S>(
112 ``` 112 ```
113 113
114 ### Get.putAsync 114 ### Get.putAsync
115 -If you want to register an asynchronous instance, you can use `Get.putAsync`: 115 + Đây là khi bạn muốn xài asynchronize code `Get.putAsync`:
116 116
117 ```dart 117 ```dart
118 Get.putAsync<SharedPreferences>(() async { 118 Get.putAsync<SharedPreferences>(() async {
@@ -124,7 +124,7 @@ Get.putAsync<SharedPreferences>(() async { @@ -124,7 +124,7 @@ Get.putAsync<SharedPreferences>(() async {
124 Get.putAsync<YourAsyncClass>( () async => await YourAsyncClass() ) 124 Get.putAsync<YourAsyncClass>( () async => await YourAsyncClass() )
125 ``` 125 ```
126 126
127 -This is all options you can set when using putAsync: 127 +Đây là tùy chọn bạn có thể đặt lệnh với putAsync:
128 ```dart 128 ```dart
129 Get.putAsync<S>( 129 Get.putAsync<S>(
130 130
@@ -143,14 +143,14 @@ Get.putAsync<S>( @@ -143,14 +143,14 @@ Get.putAsync<S>(
143 143
144 ### Get.create 144 ### Get.create
145 145
146 -This one is tricky. A detailed explanation of what this is and the differences between the other one can be found on [Differences between methods:](#differences-between-methods) section 146 +Cái này hơi khó giải thích, nhưng sự khác nhau giữa chúng có thể được tìm thấy trên mục [Differences between methods:](#differences-between-methods)
147 147
148 ```dart 148 ```dart
149 Get.Create<SomeClass>(() => SomeClass()); 149 Get.Create<SomeClass>(() => SomeClass());
150 Get.Create<LoginController>(() => LoginController()); 150 Get.Create<LoginController>(() => LoginController());
151 ``` 151 ```
152 152
153 -This is all options you can set when using create: 153 +Tùy chọn có thể sử dụng:
154 154
155 ```dart 155 ```dart
156 Get.create<S>( 156 Get.create<S>(
@@ -171,9 +171,9 @@ Get.create<S>( @@ -171,9 +171,9 @@ Get.create<S>(
171 bool permanent = true 171 bool permanent = true
172 ``` 172 ```
173 173
174 -## Using instantiated methods/classes 174 +## Sử dụng các phương thức / class
175 175
176 -Imagine that you have navigated through numerous routes, and you need a data that was left behind in your controller, you would need a state manager combined with the Provider or Get_it, correct? Not with Get. You just need to ask Get to "find" for your controller, you don't need any additional dependencies: 176 +Hãy tưởng tượng rằng bạn đã điều hướng qua nhiều route và bạn cần một dữ liệu còn sót trong controller của mình, bạn sẽ cần một trình quản lý state kết hợp với Provider hoặc Get_it, phải hem? Với Get, bạn chỉ cần yêu cầu Get to "find" cho controller của mình và thế là xong:
177 177
178 ```dart 178 ```dart
179 final controller = Get.find<Controller>(); 179 final controller = Get.find<Controller>();
@@ -184,64 +184,64 @@ Controller controller = Get.find(); @@ -184,64 +184,64 @@ Controller controller = Get.find();
184 // You can have 1 million controllers instantiated, Get will always give you the right controller. 184 // You can have 1 million controllers instantiated, Get will always give you the right controller.
185 ``` 185 ```
186 186
187 -And then you will be able to recover your controller data that was obtained back there: 187 +Và sau đó, bạn sẽ có thể khôi phục dữ liệu controller của mình đã lấy được ở đó:
188 188
189 ```dart 189 ```dart
190 Text(controller.textFromApi); 190 Text(controller.textFromApi);
191 ``` 191 ```
192 192
193 -Since the returned value is a normal class, you can do anything you want: 193 +Vì giá trị trả về là một class bình thường, bạn có thể làm bất cứ điều gì bạn muốn:
194 ```dart 194 ```dart
195 int count = Get.find<SharedPreferences>().getInt('counter'); 195 int count = Get.find<SharedPreferences>().getInt('counter');
196 print(count); // out: 12345 196 print(count); // out: 12345
197 ``` 197 ```
198 198
199 -To remove an instance of Get: 199 +Để xóa một controller đang chạy ngầm của Get:
200 200
201 ```dart 201 ```dart
202 -Get.delete<Controller>(); //usually you don't need to do this because GetX already delete unused controllers 202 +Get.delete<Controller>(); //thường thì Get tự xóa, bạn không cần phải đặt lệnh này.
203 ``` 203 ```
204 204
205 -## Differences between methods 205 +## Khác nhau giữa phương thức (methods)
206 206
207 -First, let's of the `fenix` of Get.lazyPut and the `permanent` of the other methods. 207 +Đầu tiên, hãy nói về `fenix` của Get.lazyPut và `permanent`của các phương thức khác.
208 208
209 -The fundamental difference between `permanent` and `fenix` is how you want to store your instances. 209 +Sự khác biệt cơ bản giữa `permanent` và `fenix` là cách bạn muốn lưu trữ các cá thể của mình.
210 210
211 -Reinforcing: by default, GetX deletes instances when they are not in use.  
212 -It means that: If screen 1 has controller 1 and screen 2 has controller 2 and you remove the first route from stack, (like if you use `Get.off()` or `Get.offNamed()`) the controller 1 lost its use so it will be erased. 211 +Củng cố: theo mặc định, GetX xóa các trường hợp khi chúng không được sử dụng.
  212 +Có nghĩa là: Nếu màn hình 1 có controller 1 và màn hình 2 có controller 2 và bạn xóa route đầu tiên khỏi stack, (chẳng hạn như nếu bạn sử dụng `` Get.off () 'hoặc' `Get.offNamed()``) thì controller 1 bị mất việc sử dụng nó vì vậy nó sẽ bị xóa.
213 213
214 -But if you want to opt for using `permanent:true`, then the controller will not be lost in this transition - which is very useful for services that you want to keep alive throughout the entire application. 214 +Nhưng nếu bạn muốn chọn sử dụng `permanent: true`, thì controller sẽ không bị mất trong quá trình chuyển đổi này - điều này rất hữu ích cho các dịch vụ mà bạn muốn duy trì hoạt động trong toàn bộ ứng dụng.
215 215
216 -`fenix` in the other hand is for services that you don't worry in losing between screen changes, but when you need that service, you expect that it is alive. So basically, it will dispose the unused controller/service/class, but when you need it, it will "recreate from the ashes" a new instance. 216 +Mặt khác, `fenix` dành cho các dịch vụ mà bạn không lo bị mất giữa các lần thay đổi màn hình, nhưng khi bạn cần dịch vụ đó, bạn hy vọng rằng nó vẫn tồn tại. Vì vậy, về cơ bản, nó sẽ loại bỏ controller / service / class không sử dụng, nhưng khi bạn cần, nó sẽ "tạo lại từ đống tro tàn" ở một trường hợp (instance) mới.
217 217
218 -Proceeding with the differences between methods: 218 +Tiếp tục với sự khác biệt giữa các phương pháp:
219 219
220 -- Get.put and Get.putAsync follows the same creation order, with the difference that the second uses an asynchronous method: those two methods creates and initializes the instance. That one is inserted directly in the memory, using the internal method `insert` with the parameters `permanent: false` and `isSingleton: true` (this isSingleton parameter only purpose is to tell if it is to use the dependency on `dependency` or if it is to use the dependency on `FcBuilderFunc`). After that, `Get.find()` is called that immediately initialize the instances that are on memory. 220 +- Get.put và Get.putAsync tuân theo cùng một thứ tự tạo, với sự khác biệt là một cái sử dụng phương thức không đồng bộ: hai phương thức đó đều tạo và khởi tạo các trường hợp. Cái sử dụng không đồng bộ được chèn trực tiếp vào bộ nhớ, bằng cách sử dụng phương thức nội bộ `insert` với các tham số `permanent: false` và` isSingleton: true` (tham số isSingleton này chỉ nhằm mục đích cho biết liệu nó có sử dụng dependency vào `dependency` hay không hoặc nếu nó được sử dụng dependency vào `FcBuilderFunc`). Sau đó, `Get.find ()` được gọi để khởi tạo ngay lập tức các các trường hợp trên bộ nhớ.
221 221
222 -- Get.create: As the name implies, it will "create" your dependency! Similar to `Get.put()`, it also calls the internal method `insert` to instancing. But `permanent` became true and `isSingleton` became false (since we are "creating" our dependency, there is no way for it to be a singleton instace, that's why is false). And because it has `permanent: true`, we have by default the benefit of not losing it between screens! Also, `Get.find()` is not called immediately, it wait to be used in the screen to be called. It is created this way to make use of the parameter `permanent`, since then, worth noticing, `Get.create()` was made with the goal of create not shared instances, but don't get disposed, like for example a button in a listView, that you want a unique instance for that list - because of that, Get.create must be used together with GetWidget. 222 +- Get.create: Như tên của nó, nó sẽ "tạo ra" sự dependency cho bạn! Tương tự như `Get.put ()`, nó cũng gọi phương thức nội bộ là `insert` để các trường hợp. Nhưng `permanent` trở thành true và` isSingleton` trở thành false (vì chúng ta đang "tạo" dependency của mình, không có cách nào để nó là một instace singleton, đó là lý do tại sao lại là false). Và bởi vì nó có `permanent: true`, chúng tôi mặc định có lợi ích là không bị mất nó giữa các màn hình! Ngoài ra, `` Get.find () 'không được gọi ngay lập tức, nó phải chờ được sử dụng trong màn hình để được gọi. Nó được tạo ra theo cách này để sử dụng tham số `permanent ', vì vậy, đáng chú ý là` Get.create () `được tạo ra với mục tiêu tạo ra các phiên bản không được chia sẻ, nhưng không bị loại bỏ, như ví dụ: trong listView, mà bạn muốn có một phiên bản duy nhất cho danh sách đó - do đó, Get.create phải được sử dụng cùng với GetWidget.
223 223
224 -- Get.lazyPut: As the name implies, it is a lazy proccess. The instance is create, but it is not called to be used immediately, it remains waiting to be called. Contrary to the other methods, `insert` is not called here. Instead, the instance is inserted in another part of the memory, a part responsible to tell if the instance can be recreated or not, let's call it "factory". If we want to create something to be used later, it will not be mix with things been used right now. And here is where `fenix` magic enters: if you opt to leaving `fenix: false`, and your `smartManagement` are not `keepFactory`, then when using `Get.find` the instance will change the place in the memory from the "factory" to common instance memory area. Right after that, by default it is removed from the "factory". Now, if you opt for `fenix: true`, the instance continues to exist in this dedicated part, even going to the common area, to be called again in the future. 224 +- Get.lazyPut: Như tên của nó, nó là một quy trình lười biếng. Cá thể được tạo, nhưng nó không được gọi để sử dụng ngay lập tức, nó vẫn đang chờ được gọi. Trái ngược với các phương thức khác, `insert` không được gọi ở đây. Thay vào đó, cá thể được chèn vào một phần khác của bộ nhớ, một phần chịu trách nhiệm cho biết liệu cá thể đó có thể được tạo lại hay không, chúng ta hãy gọi nó là "nhà máy". Nếu chúng ta muốn tạo ra thứ gì đó để sử dụng sau này, nó sẽ không bị trộn lẫn với những thứ đã được sử dụng ngay bây giờ. Và đây là nơi phép thuật của `fenix` đi vào: nếu bạn chọn bỏ` fenix: false`, và `smartManagement` của bạn không phải là` keepFactory`, thì khi sử dụng `Get.find`, instance sẽ thay đổi vị trí trong bộ nhớ từ "nhà máy" đến vùng bộ nhớ cá thể chung. Ngay sau đó, theo mặc định, nó được xóa khỏi "nhà máy". Bây giờ, nếu bạn chọn `fenix: true`, cá thể vẫn tiếp tục tồn tại trong phần dành riêng này, thậm chí sẽ chuyển sang vùng chung, sẽ được gọi lại trong tương lai.
225 225
226 ## Bindings 226 ## Bindings
227 227
228 -One of the great differentials of this package, perhaps, is the possibility of full integration of the routes, state manager and dependency manager.  
229 -When a route is removed from the Stack, all controllers, variables, and instances of objects related to it are removed from memory. If you are using streams or timers, they will be closed automatically, and you don't have to worry about any of that.  
230 -In version 2.10 Get completely implemented the Bindings API.  
231 -Now you no longer need to use the init method. You don't even have to type your controllers if you don't want to. You can start your controllers and services in the appropriate place for that.  
232 -The Binding class is a class that will decouple dependency injection, while "binding" routes to the state manager and dependency manager.  
233 -This allows Get to know which screen is being displayed when a particular controller is used and to know where and how to dispose of it.  
234 -In addition, the Binding class will allow you to have SmartManager configuration control. You can configure the dependencies to be arranged when removing a route from the stack, or when the widget that used it is laid out, or neither. You will have intelligent dependency management working for you, but even so, you can configure it as you wish. 228 +Có lẽ, một trong những điểm khác biệt lớn của gói này là khả năng tích hợp đầy đủ các route, trình quản lý state và trình quản lý dependency.
  229 +Khi một route bị xóa khỏi stack, tất cả các controller, biến và phiên bản của các đối tượng liên quan đến nó sẽ bị xóa khỏi bộ nhớ. Nếu bạn đang sử dụng luồng hoặc bộ hẹn giờ, chúng sẽ tự động bị đóng và bạn không phải lo lắng về bất kỳ điều gì trong số đó.
  230 +Trong phiên bản 2.10 Được triển khai hoàn toàn API bindings.
  231 +Bây giờ bạn không cần sử dụng phương thức init nữa. Bạn thậm chí không cần phải nhập controller của mình nếu bạn không muốn. Bạn có thể khởi động controller và dịch vụ của mình ở nơi thích hợp cho việc đó.
  232 +Lớp Binding là một class sẽ tách riêng việc tiêm dependency, trong khi "bindings" các route đường tới trình quản lý state và trình quản lý dependency.
  233 +Điều này cho phép Nhận biết màn hình nào đang được hiển thị khi một controller cụ thể được sử dụng và biết vị trí và cách vứt bỏ nó.
  234 +Ngoài ra, class Binding sẽ cho phép bạn kiểm soát cấu hình SmartManager. Bạn có thể định cấu hình các phần dependency được sắp xếp khi xóa một route khỏi ngăn xếp hoặc khi widget con đã sử dụng nó được bố trí hoặc không. Bạn sẽ có quản lý dependency thông minh làm việc cho bạn, nhưng ngay cả như vậy, bạn có thể định cấu hình nó theo ý muốn.
235 235
236 ### Bindings class 236 ### Bindings class
237 237
238 -- Create a class and implements Binding 238 +- Tạo một class và implements Binding
239 239
240 ```dart 240 ```dart
241 class HomeBinding implements Bindings {} 241 class HomeBinding implements Bindings {}
242 ``` 242 ```
243 243
244 -Your IDE will automatically ask you to override the "dependencies" method, and you just need to click on the lamp, override the method, and insert all the classes you are going to use on that route: 244 +IDE của bạn sẽ tự động yêu cầu bạn ghi đè phương thức "dependency" và bạn chỉ cần nhấp vào đèn, ghi đè phương thức và chèn tất cả các class bạn sẽ sử dụng trên route đó:
245 245
246 ```dart 246 ```dart
247 class HomeBinding implements Bindings { 247 class HomeBinding implements Bindings {
@@ -260,9 +260,9 @@ class DetailsBinding implements Bindings { @@ -260,9 +260,9 @@ class DetailsBinding implements Bindings {
260 } 260 }
261 ``` 261 ```
262 262
263 -Now you just need to inform your route, that you will use that binding to make the connection between route manager, dependencies and states. 263 +Bây giờ bạn chỉ cần thông báo route của mình, rằng bạn sẽ sử dụng bindings đó để tạo kết nối giữa trình quản lý route, các dependency và state.
264 264
265 -- Using named routes: 265 +- Sử dụng routes có tên:
266 266
267 ```dart 267 ```dart
268 getPages: [ 268 getPages: [
@@ -279,16 +279,16 @@ getPages: [ @@ -279,16 +279,16 @@ getPages: [
279 ]; 279 ];
280 ``` 280 ```
281 281
282 -- Using normal routes: 282 +- Sử dụng routes thường:
283 283
284 ```dart 284 ```dart
285 Get.to(Home(), binding: HomeBinding()); 285 Get.to(Home(), binding: HomeBinding());
286 Get.to(DetailsView(), binding: DetailsBinding()) 286 Get.to(DetailsView(), binding: DetailsBinding())
287 ``` 287 ```
288 288
289 -There, you don't have to worry about memory management of your application anymore, Get will do it for you. 289 +Ở đó, bạn không phải lo lắng về việc quản lý bộ nhớ của ứng dụng của mình nữa, Get sẽ thay bạn làm điều đó.
290 290
291 -The Binding class is called when a route is called, you can create an "initialBinding in your GetMaterialApp to insert all the dependencies that will be created. 291 +Lớp Binding được gọi khi một route được gọi, bạn có thể tạo một "InitialBinding trong GetMaterialApp của mình để chèn tất cả các dependency sẽ được tạo.
292 292
293 ```dart 293 ```dart
294 GetMaterialApp( 294 GetMaterialApp(
@@ -299,8 +299,8 @@ GetMaterialApp( @@ -299,8 +299,8 @@ GetMaterialApp(
299 299
300 ### BindingsBuilder 300 ### BindingsBuilder
301 301
302 -The default way of creating a binding is by creating a class that implements Bindings.  
303 -But alternatively, you can use `BindingsBuilder` callback so that you can simply use a function to instantiate whatever you desire. 302 +Cách mặc định để tạo bindings là tạo một class thực hiện các bindings.
  303 +Nhưng cách khác, bạn có thể sử dụng lệnh gọi lại `BindingsBuilder` để bạn có thể chỉ cần sử dụng một hàm để khởi tạo bất cứ thứ gì bạn muốn.
304 304
305 Example: 305 Example:
306 306
@@ -324,19 +324,19 @@ getPages: [ @@ -324,19 +324,19 @@ getPages: [
324 ]; 324 ];
325 ``` 325 ```
326 326
327 -That way you can avoid to create one Binding class for each route making this even simpler. 327 +Bằng cách đó, bạn có thể tránh tạo một class Binding cho mỗi routes, làm cho việc này trở nên đơn giản hơn.
328 328
329 -Both ways of doing work perfectly fine and we want you to use what most suit your tastes. 329 +Cả hai cách làm việc đều hoàn toàn tốt và chúng tôi muốn bạn sử dụng những gì phù hợp với sở thích của bạn nhất.
330 330
331 ### SmartManagement 331 ### SmartManagement
332 332
333 -GetX by default disposes unused controllers from memory, even if a failure occurs and a widget that uses it is not properly disposed.  
334 -This is what is called the `full` mode of dependency management.  
335 -But if you want to change the way GetX controls the disposal of classes, you have `SmartManagement` class that you can set different behaviors. 333 +GetX theo mặc định loại bỏ controller không sử dụng khỏi bộ nhớ, ngay cả khi xảy ra lỗi và widget con sử dụng nó không được xử lý đúng cách.
  334 +Đây được gọi là chế độ quản lý dependency `` đầy đủ`.
  335 +Nhưng nếu bạn muốn thay đổi cách GetX kiểm soát việc xử lý các class, bạn có class `SmartManagement` để bạn có thể thiết lập các hành vi khác nhau.
336 336
337 -#### How to change 337 +#### Cách thay đổi
338 338
339 -If you want to change this config (which you usually don't need) this is the way: 339 +Nếu bạn muốn thay đổi cấu hình này (mà bạn thường không cần) thì đây là cách:
340 340
341 ```dart 341 ```dart
342 void main () { 342 void main () {
@@ -351,30 +351,30 @@ void main () { @@ -351,30 +351,30 @@ void main () {
351 351
352 #### SmartManagement.full 352 #### SmartManagement.full
353 353
354 -It is the default one. Dispose classes that are not being used and were not set to be permanent. In the majority of the cases you will want to keep this config untouched. If you new to GetX then don't change this. 354 +Nó là một trong những mặc định. Loại bỏ các class không được sử dụng và không được đặt thành vĩnh viễn. Trong phần lớn các trường hợp, bạn sẽ muốn giữ nguyên cấu hình này. Nếu bạn mới sử dụng GetX thì đừng thay đổi điều này.
355 355
356 #### SmartManagement.onlyBuilders 356 #### SmartManagement.onlyBuilders
357 -With this option, only controllers started in `init:` or loaded into a Binding with `Get.lazyPut()` will be disposed. 357 +Với tùy chọn này, chỉ những controller bắt đầu trong `init: 'hoặc được tải vào Binding với` `Get.lazyPut ()` mới được xử lý.
358 358
359 -If you use `Get.put()` or `Get.putAsync()` or any other approach, SmartManagement will not have permissions to exclude this dependency. 359 +Nếu bạn sử dụng `Get.put () 'hoặc' Get.putAsync ()` hoặc bất kỳ cách tiếp cận nào khác, SmartManagement sẽ không có quyền loại trừ sự dependency này.
360 360
361 -With the default behavior, even widgets instantiated with "Get.put" will be removed, unlike SmartManagement.onlyBuilders. 361 +Với hành vi mặc định, ngay cả các widget con được khởi tạo bằng "Get.put" sẽ bị xóa, không giống như SmartManagement.onlyBuilders.
362 362
363 #### SmartManagement.keepFactory 363 #### SmartManagement.keepFactory
364 364
365 -Just like SmartManagement.full, it will remove it's dependencies when it's not being used anymore. However, it will keep their factory, which means it will recreate the dependency if you need that instance again. 365 +Cũng giống như SmartManagement.full, nó sẽ loại bỏ các phần dependency của nó khi nó không được sử dụng nữa. Tuy nhiên, nó sẽ giữ nguyên chế độ factory của họ, có nghĩa là nó sẽ tạo lại phần dependency nếu bạn cần lại phiên bản đó.
366 366
367 -### How bindings work under the hood  
368 -Bindings creates transitory factories, which are created the moment you click to go to another screen, and will be destroyed as soon as the screen-changing animation happens.  
369 -This happens so fast that the analyzer will not even be able to register it.  
370 -When you navigate to this screen again, a new temporary factory will be called, so this is preferable to using SmartManagement.keepFactory, but if you don't want to create Bindings, or want to keep all your dependencies on the same Binding, it will certainly help you.  
371 -Factories take up little memory, they don't hold instances, but a function with the "shape" of that class you want.  
372 -This has a very low cost in memory, but since the purpose of this lib is to get the maximum performance possible using the minimum resources, Get removes even the factories by default.  
373 -Use whichever is most convenient for you. 367 +### Cách bindings làm việc ngầm
  368 +Các liên kết tạo ra các factory tạm thời, được tạo ra ngay khi bạn nhấp để chuyển sang màn hình khác và sẽ bị phá hủy ngay sau khi hoạt ảnh thay đổi màn hình xảy ra.
  369 +Điều này xảy ra quá nhanh đến nỗi máy phân tích thậm chí sẽ không thể đăng ký nó.
  370 +Khi bạn điều hướng đến màn hình này một lần nữa, một factory tạm thời mới sẽ được gọi, vì vậy điều này thích hợp hơn khi sử dụng SmartManagement.keepFactory, nhưng nếu bạn không muốn tạo Bindings hoặc muốn giữ tất cả các dependency của mình trên cùng một Binding, thì chắc chắn sẽ giúp ích cho bạn.
  371 +Các factory chiếm ít bộ nhớ, chúng không chứa các cá thể mà là một chức năng có "hình dạng" của class đó mà bạn muốn.
  372 +Điều này có chi phí bộ nhớ rất thấp, nhưng vì mục đích của lib này là để đạt được hiệu suất tối đa có thể bằng cách sử dụng tài nguyên tối thiểu, Get xóa ngay cả các factory theo mặc định.
  373 +Sử dụng cái nào thuận tiện nhất cho bạn.
374 374
375 -## Notes 375 +## Chí ú
376 376
377 -- DO NOT USE SmartManagement.keepFactory if you are using multiple Bindings. It was designed to be used without Bindings, or with a single Binding linked in the GetMaterialApp's initialBinding. 377 +- KHÔNG SỬ DỤNG SmartManagement.keepFactory nếu bạn đang sử dụng nhiều Binding. Nó được thiết kế để sử dụng mà không có Bindings, hoặc với một Bindings duy nhất được liên kết trong `initialBinding` của GetMaterialApp.
378 378
379 -- Using Bindings is completely optional, if you want you can use `Get.put()` and `Get.find()` on classes that use a given controller without any problem.  
380 -However, if you work with Services or any other abstraction, I recommend using Bindings for a better organization. 379 +- Việc sử dụng Bindings là hoàn toàn tùy chọn, nếu muốn, bạn có thể sử dụng `Get.put () 'và' Get.find()` trên các class sử dụng controller nhất định mà không gặp bất kỳ vấn đề gì.
  380 +Tuy nhiên, nếu bạn làm việc với Service hoặc bất kỳ abstract nào khác, tôi khuyên bạn nên sử dụng Bindings để tổ chức tốt hơn.
1 -- [Route Management](#route-management)  
2 - - [How to use](#how-to-use)  
3 - - [Navigation without named routes](#navigation-without-named-routes)  
4 - - [Navigation with named routes](#navigation-with-named-routes)  
5 - - [Send data to named Routes](#send-data-to-named-routes) 1 +- [Quản lý route](#route-management)
  2 + - [Hướng dẫn sử dụng trước khi dùng](#how-to-use)
  3 + - [Điều hướng không cần tên](#navigation-without-named-routes)
  4 + - [Điều hướng cần tên](#navigation-with-named-routes)
  5 + - [Gửi data cho route có tên](#send-data-to-named-routes)
6 - [Dynamic urls links](#dynamic-urls-links) 6 - [Dynamic urls links](#dynamic-urls-links)
7 - [Middleware](#middleware) 7 - [Middleware](#middleware)
8 - - [Navigation without context](#navigation-without-context) 8 + - [Điều hướng không cần context](#navigation-without-context)
9 - [SnackBars](#snackbars) 9 - [SnackBars](#snackbars)
10 - [Dialogs](#dialogs) 10 - [Dialogs](#dialogs)
11 - [BottomSheets](#bottomsheets) 11 - [BottomSheets](#bottomsheets)
12 - - [Nested Navigation](#nested-navigation) 12 + - [Điều hướng lồng (Nested Navigation)](#nested-navigation)
13 13
14 -# Route Management 14 +# Quản lý route
15 15
16 -This is the complete explanation of all there is to Getx when the matter is route management. 16 +Đây là lời giải thích đầy đủ về tất cả những gì có cho Getx khi vấn đề là quản lý routes.
17 17
18 -## How to use 18 +## Hướng dẫn sử dụng trước khi dùng
19 19
20 -Add this to your pubspec.yaml file: 20 +Thêm cái này vào file pubspec.yaml của bạn:
21 21
22 ```yaml 22 ```yaml
23 dependencies: 23 dependencies:
24 get: 24 get:
25 ``` 25 ```
26 26
27 -If you are going to use routes/snackbars/dialogs/bottomsheets without context, or use the high-level Get APIs, you need to simply add "Get" before your MaterialApp, turning it into GetMaterialApp and enjoy! 27 +Nếu bạn định sử dụng các routes / snackbars / dialogs / bottomsheets mà không có "context" hoặc sử dụng các API cấp cao, bạn chỉ cần thêm Get trước MaterialApp của mình, biến nó thành GetMaterialApp và tung hành!
28 28
29 ```dart 29 ```dart
30 GetMaterialApp( // Before: MaterialApp( 30 GetMaterialApp( // Before: MaterialApp(
@@ -32,39 +32,39 @@ GetMaterialApp( // Before: MaterialApp( @@ -32,39 +32,39 @@ GetMaterialApp( // Before: MaterialApp(
32 ) 32 )
33 ``` 33 ```
34 34
35 -## Navigation without named routes 35 +## Điều hướng không cần tên
36 36
37 -To navigate to a new screen: 37 +Để điều hướng đến một màn hình mới:
38 38
39 ```dart 39 ```dart
40 Get.to(NextScreen()); 40 Get.to(NextScreen());
41 ``` 41 ```
42 42
43 -To close snackbars, dialogs, bottomsheets, or anything you would normally close with Navigator.pop(context); 43 +Để đóng snackbars, dialog, bottomsheets hoặc bất cứ thứ gì bạn thường đóng bằng Navigator.pop (context);
44 44
45 ```dart 45 ```dart
46 Get.back(); 46 Get.back();
47 ``` 47 ```
48 48
49 -To go to the next screen and no option to go back to the previous screen (for use in SplashScreens, login screens and etc.) 49 +Để chuyển đến màn hình tiếp theo và không có tùy chọn nào để quay lại màn hình trước đó (để sử dụng trong SplashScreens, màn hình đăng nhập, v.v.)
50 50
51 ```dart 51 ```dart
52 Get.off(NextScreen()); 52 Get.off(NextScreen());
53 ``` 53 ```
54 54
55 -To go to the next screen and cancel all previous routes (useful in shopping carts, polls, and tests) 55 +Để chuyển đến màn hình tiếp theo và hủy tất cả các lộ trình trước đó (hữu ích trong giỏ hàng, polls và test)
56 56
57 ```dart 57 ```dart
58 Get.offAll(NextScreen()); 58 Get.offAll(NextScreen());
59 ``` 59 ```
60 60
61 -To navigate to the next route, and receive or update data as soon as you return from it: 61 +Để điều hướng đến routes tiếp theo và nhận hoặc cập nhật dữ liệu ngay sau khi bạn trở về từ routes đó:
62 62
63 ```dart 63 ```dart
64 var data = await Get.to(Payment()); 64 var data = await Get.to(Payment());
65 ``` 65 ```
66 66
67 -on other screen, send a data for previous route: 67 +trên màn hình khác, gửi dữ liệu cho routes trước đó:
68 68
69 ```dart 69 ```dart
70 Get.back(result: 'success'); 70 Get.back(result: 'success');
@@ -78,9 +78,9 @@ ex: @@ -78,9 +78,9 @@ ex:
78 if(data == 'success') madeAnything(); 78 if(data == 'success') madeAnything();
79 ``` 79 ```
80 80
81 -Don't you want to learn our syntax?  
82 -Just change the Navigator (uppercase) to navigator (lowercase), and you will have all the functions of the standard navigation, without having to use context  
83 -Example: 81 +Bạn không muốn học cú pháp của chúng tôi?
  82 +Chỉ cần thay đổi Navigator (chữ in hoa) thành navigator (chữ thường) và bạn sẽ có tất cả các chức năng của điều hướng tiêu chuẩn mà không cần phải sử dụng "context"
  83 +Thí dụ:
84 84
85 ```dart 85 ```dart
86 86
@@ -109,9 +109,9 @@ Get.to(HomePage()); @@ -109,9 +109,9 @@ Get.to(HomePage());
109 109
110 ``` 110 ```
111 111
112 -## Navigation with named routes 112 +## Điều hướng cần tên
113 113
114 -- If you prefer to navigate by namedRoutes, Get also supports this. 114 +- Nếu bạn thích điều hướng bằng tên, Get cũng hỗ trợ điều này.
115 115
116 To navigate to nextScreen 116 To navigate to nextScreen
117 117
@@ -119,19 +119,19 @@ To navigate to nextScreen @@ -119,19 +119,19 @@ To navigate to nextScreen
119 Get.toNamed("/NextScreen"); 119 Get.toNamed("/NextScreen");
120 ``` 120 ```
121 121
122 -To navigate and remove the previous screen from the tree. 122 +Để điều hướng và xóa màn hình trước đó khỏi cây widget.
123 123
124 ```dart 124 ```dart
125 Get.offNamed("/NextScreen"); 125 Get.offNamed("/NextScreen");
126 ``` 126 ```
127 127
128 -To navigate and remove all previous screens from the tree. 128 +Để điều hướng và xóa tất cả các màn hình trước đó khỏi cây widget.
129 129
130 ```dart 130 ```dart
131 Get.offAllNamed("/NextScreen"); 131 Get.offAllNamed("/NextScreen");
132 ``` 132 ```
133 133
134 -To define routes, use GetMaterialApp: 134 +Để định dạng routes, sử dụng GetMaterialApp:
135 135
136 ```dart 136 ```dart
137 void main() { 137 void main() {
@@ -152,7 +152,7 @@ void main() { @@ -152,7 +152,7 @@ void main() {
152 } 152 }
153 ``` 153 ```
154 154
155 -To handle navigation to non-defined routes (404 error), you can define an unknownRoute page in GetMaterialApp. 155 +Để xử lý điều hướng đến các routes không được xác định (lỗi 404), bạn có thể xác định trang 'không xác định' trong GetMaterialApp.
156 156
157 ```dart 157 ```dart
158 void main() { 158 void main() {
@@ -169,15 +169,15 @@ void main() { @@ -169,15 +169,15 @@ void main() {
169 } 169 }
170 ``` 170 ```
171 171
172 -### Send data to named Routes 172 +### Gửi data cho route có tên
173 173
174 -Just send what you want for arguments. Get accepts anything here, whether it is a String, a Map, a List, or even a class instance. 174 +Chỉ cần gửi những gì bạn muốn cho các đối số (arguments). Get chấp nhận bất kỳ thứ gì ở đây, cho dù đó là String, Map, List hay thậm chí là một class trường hợp.
175 175
176 ```dart 176 ```dart
177 Get.toNamed("/NextScreen", arguments: 'Get is the best'); 177 Get.toNamed("/NextScreen", arguments: 'Get is the best');
178 ``` 178 ```
179 179
180 -on your class or controller: 180 +Trong class controller của bạn:
181 181
182 ```dart 182 ```dart
183 print(Get.arguments); 183 print(Get.arguments);
@@ -186,13 +186,13 @@ print(Get.arguments); @@ -186,13 +186,13 @@ print(Get.arguments);
186 186
187 ### Dynamic urls links 187 ### Dynamic urls links
188 188
189 -Get offer advanced dynamic urls just like on the Web. Web developers have probably already wanted this feature on Flutter, and most likely have seen a package promise this feature and deliver a totally different syntax than a URL would have on web, but Get also solves that. 189 +Get hỗ trợ các url động nâng cao giống như trên Web. Các nhà phát triển web có lẽ đã muốn tính năng này trên Flutter và rất có thể đã thấy một gói hứa hẹn tính năng này và cung cấp một cú pháp hoàn toàn khác so với một URL sẽ có trên web, và Get cũng giải quyết được điều này.
190 190
191 ```dart 191 ```dart
192 Get.offAllNamed("/NextScreen?device=phone&id=354&name=Enzo"); 192 Get.offAllNamed("/NextScreen?device=phone&id=354&name=Enzo");
193 ``` 193 ```
194 194
195 -on your controller/bloc/stateful/stateless class: 195 +trong controller/bloc/stateful/stateless của class:
196 196
197 ```dart 197 ```dart
198 print(Get.parameters['id']); 198 print(Get.parameters['id']);
@@ -201,7 +201,7 @@ print(Get.parameters['name']); @@ -201,7 +201,7 @@ print(Get.parameters['name']);
201 // out: Enzo 201 // out: Enzo
202 ``` 202 ```
203 203
204 -You can also receive NamedParameters with Get easily: 204 +Bạn có thể đặt NamedParameters với Get dễ dàng:
205 205
206 ```dart 206 ```dart
207 void main() { 207 void main() {
@@ -233,20 +233,20 @@ void main() { @@ -233,20 +233,20 @@ void main() {
233 } 233 }
234 ``` 234 ```
235 235
236 -Send data on route name 236 +Gửi data bằng tên
237 237
238 ```dart 238 ```dart
239 Get.toNamed("/profile/34954"); 239 Get.toNamed("/profile/34954");
240 ``` 240 ```
241 241
242 -On second screen take the data by parameter 242 +Trên màn hình thứ hai, lấy dữ liệu theo tham số (parameters)
243 243
244 ```dart 244 ```dart
245 print(Get.parameters['user']); 245 print(Get.parameters['user']);
246 // out: 34954 246 // out: 34954
247 ``` 247 ```
248 248
249 -or send multiple parameters like this 249 +hoặc gửi nhiều tham số như thế này
250 250
251 ```dart 251 ```dart
252 Get.toNamed("/profile/34954?flag=true&country=italy"); 252 Get.toNamed("/profile/34954?flag=true&country=italy");
@@ -257,7 +257,7 @@ var parameters = <String, String>{"flag": "true","country": "italy",}; @@ -257,7 +257,7 @@ var parameters = <String, String>{"flag": "true","country": "italy",};
257 Get.toNamed("/profile/34954", parameters: parameters); 257 Get.toNamed("/profile/34954", parameters: parameters);
258 ``` 258 ```
259 259
260 -On second screen take the data by parameters as usually 260 +Trên màn hình thứ hai, lấy dữ liệu theo các tham số như thường lệ
261 261
262 ```dart 262 ```dart
263 print(Get.parameters['user']); 263 print(Get.parameters['user']);
@@ -268,11 +268,11 @@ print(Get.parameters['country']); @@ -268,11 +268,11 @@ print(Get.parameters['country']);
268 268
269 269
270 270
271 -And now, all you need to do is use Get.toNamed() to navigate your named routes, without any context (you can call your routes directly from your BLoC or Controller class), and when your app is compiled to the web, your routes will appear in the url <3 271 +Và bây giờ, tất cả những gì bạn cần làm là sử dụng Get.toNamed () để điều hướng các routes đã đặt tên của bạn mà không cần bất kỳ "context" nào (bạn có thể gọi các routes của mình trực tiếp từ BLoC hoặc lớp Bộ điều khiển) và khi ứng dụng của bạn được biên dịch lên web, các routes sẽ xuất hiện trong url <3
272 272
273 ### Middleware 273 ### Middleware
274 274
275 -If you want listen Get events to trigger actions, you can to use routingCallback to it 275 +Nếu bạn muốn nghe Get events để kích hoạt các hành động, bạn có thể sử dụng routingCallback cho nó
276 276
277 ```dart 277 ```dart
278 GetMaterialApp( 278 GetMaterialApp(
@@ -284,7 +284,7 @@ GetMaterialApp( @@ -284,7 +284,7 @@ GetMaterialApp(
284 ) 284 )
285 ``` 285 ```
286 286
287 -If you are not using GetMaterialApp, you can use the manual API to attach Middleware observer. 287 +Nếu bạn không sử dụng GetMaterialApp, bạn có thể sử dụng API thủ công để đính kèm trình quan sát Middleware.
288 288
289 ```dart 289 ```dart
290 void main() { 290 void main() {
@@ -301,7 +301,7 @@ void main() { @@ -301,7 +301,7 @@ void main() {
301 } 301 }
302 ``` 302 ```
303 303
304 -Create a MiddleWare class 304 +Tạo một MiddleWare class
305 305
306 ```dart 306 ```dart
307 class MiddleWare { 307 class MiddleWare {
@@ -318,7 +318,7 @@ class MiddleWare { @@ -318,7 +318,7 @@ class MiddleWare {
318 } 318 }
319 ``` 319 ```
320 320
321 -Now, use Get on your code: 321 +Bây giờ, hãy sử dụng Get trên code của bạn:
322 322
323 ```dart 323 ```dart
324 class First extends StatelessWidget { 324 class First extends StatelessWidget {
@@ -391,11 +391,11 @@ class Third extends StatelessWidget { @@ -391,11 +391,11 @@ class Third extends StatelessWidget {
391 } 391 }
392 ``` 392 ```
393 393
394 -## Navigation without context 394 +## Điều hướng không cần context
395 395
396 ### SnackBars 396 ### SnackBars
397 397
398 -To have a simple SnackBar with Flutter, you must get the context of Scaffold, or you must use a GlobalKey attached to your Scaffold 398 +Để có một SnackBar đơn giản với Flutter, bạn phải lấy context của Scaffold, hoặc bạn phải sử dụng GlobalKey được gắn vào Scaffold của bạn
399 399
400 ```dart 400 ```dart
401 final snackBar = SnackBar( 401 final snackBar = SnackBar(
@@ -416,7 +416,7 @@ With Get: @@ -416,7 +416,7 @@ With Get:
416 Get.snackbar('Hi', 'i am a modern snackbar'); 416 Get.snackbar('Hi', 'i am a modern snackbar');
417 ``` 417 ```
418 418
419 -With Get, all you have to do is call your Get.snackbar from anywhere in your code or customize it however you want! 419 +Với Get, tất cả những gì bạn phải làm là gọi thanh Get.snackbar từ bất kỳ đâu trong code của bạn hoặc tùy chỉnh nó theo cách bạn muốn!
420 420
421 ```dart 421 ```dart
422 Get.snackbar( 422 Get.snackbar(
@@ -468,8 +468,8 @@ Get.snackbar( @@ -468,8 +468,8 @@ Get.snackbar(
468 /////////////////////////////////// 468 ///////////////////////////////////
469 ``` 469 ```
470 470
471 -If you prefer the traditional snackbar, or want to customize it from scratch, including adding just one line (Get.snackbar makes use of a mandatory title and message), you can use  
472 -`Get.rawSnackbar();` which provides the RAW API on which Get.snackbar was built. 471 +Nếu bạn thích snackbar truyền thống hoặc muốn tùy chỉnh nó từ đầu, bao gồm chỉ thêm một dòng (Get.snackbar sử dụng tiêu đề và thông báo bắt buộc), bạn có thể sử dụng
  472 +`Get.rawSnackbar ()`; 'cung cấp API RAW trên đó Get.
473 473
474 ### Dialogs 474 ### Dialogs
475 475
@@ -488,15 +488,15 @@ Get.defaultDialog( @@ -488,15 +488,15 @@ Get.defaultDialog(
488 ); 488 );
489 ``` 489 ```
490 490
491 -You can also use Get.generalDialog instead of showGeneralDialog. 491 +Bạn cũng có thể sử dụng Get.generalDialog thay vì showGeneralDialog.
492 492
493 -For all other Flutter dialog widgets, including cupertinos, you can use Get.overlayContext instead of context, and open it anywhere in your code.  
494 -For widgets that don't use Overlay, you can use Get.context.  
495 -These two contexts will work in 99% of cases to replace the context of your UI, except for cases where inheritedWidget is used without a navigation context. 493 +Đối với tất cả các tiện ích hộp thoại Flutter khác, bao gồm cả cupertinos, bạn có thể sử dụng Get.overlayContext thay vì context và mở nó ở bất kỳ đâu trong mã của bạn.
  494 +Đối với các widget không sử dụng Overlay, bạn có thể sử dụng Get.context.
  495 +Hai context này sẽ hoạt động trong 99% trường hợp để thay thế context của UI của bạn, ngoại trừ các trường hợp trong đó inheritWidget được sử dụng mà không có context điều hướng.
496 496
497 ### BottomSheets 497 ### BottomSheets
498 498
499 -Get.bottomSheet is like showModalBottomSheet, but don't need of context. 499 +Get.bottomSheet giống như showModalBottomSheet, nhưng không cần context.
500 500
501 ```dart 501 ```dart
502 Get.bottomSheet( 502 Get.bottomSheet(
@@ -519,14 +519,14 @@ Get.bottomSheet( @@ -519,14 +519,14 @@ Get.bottomSheet(
519 ); 519 );
520 ``` 520 ```
521 521
522 -## Nested Navigation 522 +## Điều hướng lồng (Nested Navigation)
523 523
524 -Get made Flutter's nested navigation even easier.  
525 -You don't need the context, and you will find your navigation stack by Id. 524 +Làm cho điều hướng lồng (nested navigation) của Flutter thậm chí còn dễ dàng hơn.
  525 +Bạn không cần context và bạn sẽ tìm thấy stack điều hướng của mình theo Id.
526 526
527 -- NOTE: Creating parallel navigation stacks can be dangerous. The ideal is not to use NestedNavigators, or to use sparingly. If your project requires it, go ahead, but keep in mind that keeping multiple navigation stacks in memory may not be a good idea for RAM consumption. 527 +- CHÍ Ú: Việc tạo các stack điều hướng song song có thể gây nguy hiểm. Lý tưởng nhất là không sử dụng NestedNavigators, hoặc sử dụng một cách tối thiểu. Nếu dự án của bạn yêu cầu, hãy tiếp tục, nhưng hãy nhớ rằng việc giữ nhiều stack điều hướng trong bộ nhớ có thể không phải là một ý tưởng hay cho việc tiêu thụ RAM.
528 528
529 -See how simple it is: 529 +Xem nó code đơn giản nè:
530 530
531 ```dart 531 ```dart
532 Navigator( 532 Navigator(
1 -* [State Management](#state-management)  
2 - + [Reactive State Manager](#reactive-state-manager)  
3 - - [Advantages](#advantages)  
4 - - [Maximum performance:](#maximum-performance)  
5 - - [Declaring a reactive variable](#declaring-a-reactive-variable)  
6 - - [Having a reactive state, is easy.](#having-a-reactive-state-is-easy)  
7 - - [Using the values in the view](#using-the-values-in-the-view)  
8 - - [Conditions to rebuild](#conditions-to-rebuild)  
9 - - [Where .obs can be used](#where-obs-can-be-used)  
10 - - [Note about Lists](#note-about-lists)  
11 - - [Why i have to use .value](#why-i-have-to-use-value) 1 +* [Quản lý State](#state-management)
  2 + + [Quản lý Reactive State](#reactive-state-manager)
  3 + - [Lợi thế](#advantages)
  4 + - [Hiệu suất tối đa:](#maximum-performance)
  5 + - [Khai báo một biến phản ứng (reactive variable)](#declaring-a-reactive-variable)
  6 + - [Thât dễ khi có reactive state.](#having-a-reactive-state-is-easy)
  7 + - [Sử dụng values trong View](#using-the-values-in-the-view)
  8 + - [Điều kiện để tái tạo lại](#conditions-to-rebuild)
  9 + - [Nơi .obs có thể dùng](#where-obs-can-be-used)
  10 + - [Chí ú về Lists](#note-about-lists)
  11 + - [Tại sao tôi phải dùng .value](#why-i-have-to-use-value)
12 - [Obx()](#obx) 12 - [Obx()](#obx)
13 - [Workers](#workers) 13 - [Workers](#workers)
14 - + [Simple State Manager](#simple-state-manager)  
15 - - [Advantages](#advantages-1)  
16 - - [Usage](#usage)  
17 - - [How it handles controllers](#how-it-handles-controllers)  
18 - - [You won't need StatefulWidgets anymore](#you-wont-need-statefulwidgets-anymore)  
19 - - [Why it exists](#why-it-exists)  
20 - - [Other ways of using it](#other-ways-of-using-it)  
21 - - [Unique IDs](#unique-ids)  
22 - + [Mixing the two state managers](#mixing-the-two-state-managers) 14 + + [Quản lý State đơn giản](#simple-state-manager)
  15 + - [Lợi thế](#advantages-1)
  16 + - [Sử dụng](#usage)
  17 + - [Cách GetX sử dụng controllers](#how-it-handles-controllers)
  18 + - [Không cần StatefulWidget nữa!](#you-wont-need-statefulwidgets-anymore)
  19 + - [Tại sao GetX tồn tại?](#why-it-exists)
  20 + - [Cách sử dụng khác](#other-ways-of-using-it)
  21 + - [IDs độc nhất](#unique-ids)
  22 + + [Trộn hai trình quản lý state](#mixing-the-two-state-managers)
23 + [GetBuilder vs GetX vs Obx vs MixinBuilder](#getbuilder-vs-getx-vs-obx-vs-mixinbuilder) 23 + [GetBuilder vs GetX vs Obx vs MixinBuilder](#getbuilder-vs-getx-vs-obx-vs-mixinbuilder)
24 24
25 -# State Management 25 +# Quản lý State
26 26
27 -GetX does not use Streams or ChangeNotifier like other state managers. Why? In addition to building applications for android, iOS, web, linux, macos and linux, with GetX you can build server applications with the same syntax as Flutter/GetX. In order to improve response time and reduce RAM consumption, we created GetValue and GetStream, which are low latency solutions that deliver a lot of performance, at a low operating cost. We use this base to build all of our resources, including state management. 27 +GetX không sử dụng Streams hoặc ChangeNotifier như các quản lý state khác. Tại sao? Ngoài việc xây dựng các ứng dụng cho android, iOS, web, linux, macos và linux, với GetX bạn có thể xây dựng các ứng dụng máy chủ với cú pháp tương tự như Flutter / GetX. Để cải thiện thời gian phản hồi và giảm mức tiêu thụ RAM, chúng tôi đã tạo GetValue và GetStream, là các giải pháp có độ trễ thấp mang lại nhiều hiệu suất với chi phí vận hành thấp. Chúng tôi sử dụng cơ sở này để xây dựng tất cả các nguồn lực của mình, bao gồm cả quản lý state.
28 28
29 -* _Complexity_: Some state managers are complex and have a lot of boilerplate. With GetX you don't have to define a class for each event, the code is highly clean and clear, and you do a lot more by writing less. Many people have given up on Flutter because of this topic, and they now finally have a stupidly simple solution for managing states.  
30 -* _No code generators_: You spend half your development time writing your application logic. Some state managers rely on code generators to have minimally readable code. Changing a variable and having to run build_runner can be unproductive, and often the waiting time after a flutter clean will be long, and you will have to drink a lot of coffee. 29 +* _Phức hợp_: Một số quản lý state rất phức tạp và có rất nhiều cơ sở hạ tầng. Với GetX, bạn không phải xác định một class cho mỗi event, code rất rõ ràng và rõ ràng, và bạn làm được nhiều việc hơn bằng cách viết ít hơn. Nhiều người đã từ bỏ Flutter vì chủ đề này, và cuối cùng họ đã có một giải pháp đơn giản đến mức đần độn để quản lý các state.
  30 +* _Không trình tạo mã_: Bạn dành một nửa thời gian phát triển để viết logic ứng dụng của mình. Một số quản lý state dựa vào trình tạo mã để có mã có thể đọc được ở mức tối thiểu. Việc thay đổi một biến và phải chạy build_runner có thể gây mất hiệu quả, chuyện này rất ngốn thời gian chờ đợi sau khi quét sạch sẽ rất lâu và bạn phải uống rất nhiều cà phê.
31 31
32 -With GetX everything is reactive, and nothing depends on code generators, increasing your productivity in all aspects of your development. 32 +Với GetX, mọi thứ đều hoạt động và độc lập với trình tạo mã, giúp tăng năng suất của bạn trong mọi khía cạnh phát triển của bạn.
33 33
34 -* _It does not depend on context_: You probably already needed to send the context of your view to a controller, making the View's coupling with your business logic high. You have probably had to use a dependency for a place that has no context, and had to pass the context through various classes and functions. This just doesn't exist with GetX. You have access to your controllers from within your controllers without any context. You don't need to send the context by parameter for literally nothing.  
35 -* _Granular control_: most state managers are based on ChangeNotifier. ChangeNotifier will notify all widgets that depend on it when notifyListeners is called. If you have 40 widgets on one screen, which have a variable of your ChangeNotifier class, when you update one, all of them will be rebuilt. 34 +* _Không phụ thuộc vào context_: Có thể bạn đã cần gửi context của chế độ xem của mình tới controller, làm cho khả năng kết hợp của View với business logic của bạn cao hơn. Bạn có thể phải sử dụng một dependency cho một nơi không có context và phải chuyển context qua các class và hàm khác nhau. Điều này không tồn tại với GetX. Bạn có quyền truy cập vào controller của mình từ bên trong controller mà không cần bất kỳ context nào. Bạn không cần phải gửi context theo tham số vì không có gì theo nghĩa đen.
  35 +* _Kiểm soát hạt_: Hầu hết các quản lý state đều dựa trên ChangeNotifier. ChangeNotifier sẽ thông báo cho tất cả các widget phụ thuộc vào nó khi thông báo cho các widget được gọi. Nếu bạn có 40 widget con trên một màn hình, trong đó có một biến thuộc class ChangeNotifier của bạn, khi bạn cập nhật một widget con, tất cả chúng sẽ được xây dựng lại.
36 36
37 -With GetX, even nested widgets are respected. If you have Obx watching your ListView, and another watching a checkbox inside the ListView, when changing the CheckBox value, only it will be updated, when changing the List value, only the ListView will be updated. 37 +Với GetX, ngay cả các widget lồng nhau cũng được tôn trọng. Nếu bạn có Obx đang xem ListView của bạn và người khác đang xem hộp kiểm bên trong ListView, thì khi thay đổi giá trị CheckBox, chỉ nó mới được cập nhật, khi thay đổi giá trị List, chỉ ListView sẽ được cập nhật.
38 38
39 -* _It only reconstructs if its variable REALLY changes_: GetX has flow control, that means if you display a Text with 'Paola', if you change the observable variable to 'Paola' again, the widget will not be reconstructed. That's because GetX knows that 'Paola' is already being displayed in Text, and will not do unnecessary reconstructions. 39 +* _Chỉ tái tạo lại nếu biến CẦN thay đổi_: GetX có tính năng kiểm soát streams, điều đó có nghĩa là nếu bạn hiển thị Text là 'Kaiser', nếu bạn thay đổi lại biến có thể quan sát thành 'Kaiser', widget sẽ không được tạo lại. Đó là bởi vì GetX biết rằng 'Kaiser' đã được hiển thị trong Văn bản và sẽ không thực hiện các thao tác tái tạo không cần thiết.
40 40
41 -Most (if not all) current state managers will rebuild on the screen. 41 +Hầu hết (nếu không phải tất cả) các trình quản lý state hiện tại sẽ xây dựng lại trên màn hình.
42 42
43 -## Reactive State Manager 43 +## Quản lý Reactive State
44 44
45 -Reactive programming can alienate many people because it is said to be complicated. GetX turns reactive programming into something quite simple: 45 +Lập trình phản ứng (Reactive programming) có thể khiến nhiều người xa lánh vì nó được cho là phức tạp. GetX biến lập trình phản ứng thành một thứ khá đơn giản:
46 46
47 -* You won't need to create StreamControllers.  
48 -* You won't need to create a StreamBuilder for each variable  
49 -* You will not need to create a class for each state.  
50 -* You will not need to create a get for an initial value. 47 +* Bạn sẽ không cần tạo StreamControllers.
  48 +* Bạn sẽ không cần tạo StreamBuilder cho mỗi biến
  49 +* Bạn sẽ không cần phải tạo một class cho mỗi state.
  50 +* Bạn sẽ không cần tạo get cho một giá trị ban đầu.
51 51
52 -Reactive programming with Get is as easy as using setState. 52 +Lập trình phản ứng với Get dễ dàng như sử dụng setState.
53 53
54 -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. 54 +Hãy tưởng tượng rằng bạn có một biến tên và muốn rằng mỗi khi bạn thay đổi nó, tất cả các widget sử dụng nó sẽ được tự động thay đổi.
55 55
56 -This is your count variable: 56 +Đây là count variable của bạn:
57 57
58 ``` dart 58 ``` dart
59 -var name = 'Jonatas Borges'; 59 +var name = 'Khang Huỳnh';
60 ``` 60 ```
61 61
62 -To make it observable, you just need to add ".obs" to the end of it: 62 +Để làm cho nó có thể quan sát được, bạn chỉ cần thêm ".obs" vào cuối nó:
63 63
64 ``` dart 64 ``` dart
65 -var name = 'Jonatas Borges'.obs; 65 +var name = 'Khang Huỳnh'.obs;
66 ``` 66 ```
67 67
68 -That's all. It's *that* simple. 68 +Chỉ vậy thôi, chỉ *vậy thôi* người ơi~
69 69
70 -From now on, we might refer to this reactive-".obs"(ervables) variables as _Rx_. 70 +Từ bây giờ, chúng ta có thể tham chiếu đến các biến reactive - ". Obs" (có thể thay thế) này là _Rx_.
71 71
72 -What did we do under the hood? We created a `Stream` of `String` s, assigned the initial value `"Jonatas Borges"` , we notified all widgets that use `"Jonatas Borges"` that they now "belong" to this variable, and when the _Rx_ value changes, they will have to change as well. 72 +Chúng tôi đã làm gì phía dưới class code? Chúng tôi đã tạo một `Stream` của `String`, được gán giá trị ban đầu `"Khang Huỳnh"`, chúng tôi đã thông báo cho tất cả các widget con sử dụng `"Khang Huỳnh"` rằng chúng hiện "thuộc về" biến này và khi giá trị _Rx_ thay đổi, chúng phải thay đổi theo.
  73 +Đây là **phép màu của GetX**, nhờ vào khả năng của Dart.
73 74
74 -This is the **magic of GetX**, thanks to Dart's capabilities. 75 +Tuy nhiên, như chúng ta đã biết, một `Widget` chỉ có thể được thay đổi nếu nó nằm bên trong một hàm, bởi vì các class tĩnh không có quyền" tự động thay đổi ".
75 76
76 -But, as we know, a `Widget` can only be changed if it is inside a function, because static classes do not have the power to "auto-change". 77 +Bạn sẽ cần tạo một `StreamBuilder`, đăng ký biến này để lắng nghe các thay đổi và tạo một "stream" các` StreamBuilder` lồng nhau nếu bạn muốn thay đổi một số biến trong cùng một phạm vi, phải không?
77 78
78 -You will need to create a `StreamBuilder` , subscribe to this variable to listen for changes, and create a "cascade" of nested `StreamBuilder` if you want to change several variables in the same scope, right? 79 +Không, bạn không cần `StreamBuilder`, nhưng bạn đã đúng về các class tĩnh.
79 80
80 -No, you don't need a `StreamBuilder` , but you are right about static classes. 81 +Theo quan điểm, chúng ta thường có rất nhiều bảng soạn sẵn khi chúng ta muốn thay đổi một Widget cụ thể, đó là cách Flutter.
  82 +Với ** GetX **, bạn cũng có thể quên mã soạn sẵn này.
81 83
82 -Well, in the view, we usually have a lot of boilerplate when we want to change a specific Widget, that's the Flutter way.  
83 -With **GetX** you can also forget about this boilerplate code.  
84 -  
85 -`StreamBuilder( … )` ? `initialValue: …` ? `builder: …` ? Nope, you just need to place this variable inside an `Obx()` Widget. 84 +`StreamBuilder (…)`? `initialValue:…`? `builder:…`? Không, bạn chỉ cần đặt biến này bên trong Widget `Obx ()`.
86 85
87 ``` dart 86 ``` dart
88 Obx (() => Text (controller.name)); 87 Obx (() => Text (controller.name));
89 ``` 88 ```
90 89
91 -_What do you need to memorize?_ Only `Obx(() =>` . 90 +_Bạn cần nhớ gì?_ Chỉ `Obx(() =>` .
92 91
93 -You are just passing that Widget through an arrow-function into an `Obx()` (the "Observer" of the _Rx_). 92 +Bạn chỉ đang chuyển Widget đó thông qua một hàm mũi tên vào một `Obx ()` ("Observer" của _Rx_).
94 93
95 -`Obx` is pretty smart, and will only change if the value of `controller.name` changes. 94 +`Obx` khá thông minh và sẽ chỉ thay đổi nếu giá trị của `controller.name` thay đổi.
96 95
97 -If `name` is `"John"` , and you change it to `"John"` ( `name.value = "John"` ), as it's the same `value` as before, nothing will change on the screen, and `Obx` , to save resources, will simply ignore the new value and not rebuild the Widget. **Isn't that amazing?** 96 +Nếu `name` là` "Kaiser" `và bạn thay đổi nó thành` "Kaiser" `(` name.value = "Kaiser" `), vì nó giống như` giá trị` như trước, sẽ không có gì thay đổi trên màn hình, và `Obx`, để tiết kiệm tài nguyên, sẽ đơn giản bỏ qua giá trị mới và không xây dựng lại Widget. **Tuyệt vời ông mặt trời chứ?**
98 97
99 > So, what if I have 5 _Rx_ (observable) variables within an `Obx` ? 98 > So, what if I have 5 _Rx_ (observable) variables within an `Obx` ?
100 99
101 -It will just update when **any** of them changes. 100 +Nó sẽ chỉ cập nhật khi ** bất kỳ ** nào trong số chúng thay đổi.
102 101
103 > And if I have 30 variables in a class, when I update one, will it update **all** the variables that are in that class? 102 > And if I have 30 variables in a class, when I update one, will it update **all** the variables that are in that class?
104 103
105 -Nope, just the **specific Widget** that uses that _Rx_ variable. 104 +Không, chỉ **Widget cụ thể** sử dụng biến _Rx_ đó.
106 105
107 -So, **GetX** only updates the screen, when the _Rx_ variable changes it's value. 106 +Vì vậy, **GetX** chỉ cập nhật màn hình, khi biến _Rx_ thay đổi giá trị của nó.
108 107
109 ``` 108 ```
110 109
@@ -114,44 +113,42 @@ final isOpen = false.obs; @@ -114,44 +113,42 @@ final isOpen = false.obs;
114 void onButtonTap() => isOpen.value=false; 113 void onButtonTap() => isOpen.value=false;
115 ``` 114 ```
116 115
117 -### Advantages 116 +### Lợi thế
118 117
119 -**GetX()** helps you when you need **granular** control over what's being updated. 118 +**GetX()** giúp bạn khi bạn cần kiểm soát **chi tiết** đối với những gì đang được cập nhật.
120 119
121 -If you do not need `unique IDs` , because all your variables will be modified when you perform an action, then use `GetBuilder` ,  
122 -because it's a Simple State Updater (in blocks, like `setState()` ), made in just a few lines of code.  
123 -It was made simple, to have the least CPU impact, and just to fulfill a single purpose (a _State_ rebuild) and spend the minimum resources possible. 120 +Nếu bạn không cần `ID duy nhất`, vì tất cả các biến của bạn sẽ được sửa đổi khi bạn thực hiện một hành động, thì hãy sử dụng` GetBuilder`,
  121 +bởi vì nó là một Trình cập nhật state đơn giản (trong các khối, như `setState ()` '), được tạo chỉ trong một vài dòng mã.
  122 +Nó được làm đơn giản, ít ảnh hưởng đến CPU nhất và chỉ để thực hiện một mục đích duy nhất (xây dựng lại _State_) và sử dụng tài nguyên tối thiểu có thể.
124 123
125 -If you need a **powerful** State Manager, you can't go wrong with **GetX**. 124 +Nếu bạn cần một Trình quản lý state **mạnh mẽ**, bạn không thể làm sai với **GetX**.
126 125
127 -It doesn't work with variables, but __flows__, everything in it are `Streams` under the hood. 126 +Nó không hoạt động với các biến, nhưng __flows__, mọi thứ trong đó đều là `Streams`.
128 127
129 -You can use _rxDart_ in conjunction with it, because everything are `Streams`,  
130 -you can listen to the `event` of each "_Rx_ variable",  
131 -because everything in it are `Streams`. 128 +Bạn có thể sử dụng _rxDart_ kết hợp với nó, vì mọi thứ đều là `Luồng`,
  129 +bạn có thể nghe `event` của từng" biến _Rx_ ",
  130 +bởi vì mọi thứ trong đó đều là `Streams`.
132 131
133 -It is literally a _BLoC_ approach, easier than _MobX_, and without code generators or decorations.  
134 -You can turn **anything** into an _"Observable"_ with just a `.obs` . 132 +Nó thực sự là một cách tiếp cận _BLoC_, dễ dàng hơn _MobX_ và không có trình tạo code hoặc decorations.
  133 +Bạn có thể biến **mọi thứ** thành một _"Observable" _ chỉ với một `.obs`.
135 134
136 -### Maximum performance: 135 +### Hiệu suất tối đa:
137 136
138 -In addition to having a smart algorithm for minimal rebuilds, **GetX** uses comparators  
139 -to make sure the State has changed. 137 +Ngoài việc có một thuật toán thông minh để xây dựng lại tối thiểu, **GetX** sử dụng trình so sánh để đảm bảo rằng Bang đã thay đổi.
140 138
141 -If you experience any errors in your app, and send a duplicate change of State,  
142 -**GetX** will ensure it will not crash. 139 +Nếu bạn gặp bất kỳ lỗi nào trong ứng dụng của mình và gửi một bản thay đổi state, **GetX** sẽ đảm bảo rằng nó sẽ không gặp sự cố.
143 140
144 -With **GetX** the State only changes if the `value` change.  
145 -That's the main difference between **GetX**, and using _ `computed` from MobX_.  
146 -When joining two __observables__, and one changes; the listener of that _observable_ will change as well. 141 +Với **GetX** State chỉ thay đổi nếu `giá trị` thay đổi.
  142 +Đó là sự khác biệt chính giữa **GetX** và việc sử dụng _ `computed` từ MobX_.
  143 +Khi kết hợp hai __observables__, và một thay đổi; trình nghe của _observable_ đó cũng sẽ thay đổi.
147 144
148 -With **GetX**, if you join two variables, `GetX()` (similar to `Observer()` ) will only rebuild if it implies a real change of State. 145 +Với **GetX**, nếu bạn nối hai biến, `GetX ()` (tương tự như `Observer ()`) sẽ chỉ xây dựng lại nếu nó ngụ ý thay đổi state thực sự.
149 146
150 -### Declaring a reactive variable 147 +### Khai báo một biến phản ứng (reactive variable)
151 148
152 -You have 3 ways to turn a variable into an "observable". 149 +Bạn có 3 cách để thay đổi variable thành "observable".
153 150
154 -1 - The first is using **`Rx{Type}`**. 151 +1 - Sử dụng **`Rx{Type}`**.
155 152
156 ``` dart 153 ``` dart
157 // initial value is recommended, but not mandatory 154 // initial value is recommended, but not mandatory
@@ -163,7 +160,7 @@ final items = RxList<String>([]); @@ -163,7 +160,7 @@ final items = RxList<String>([]);
163 final myMap = RxMap<String, int>({}); 160 final myMap = RxMap<String, int>({});
164 ``` 161 ```
165 162
166 -2 - The second is to use **`Rx`** and use Darts Generics, `Rx<Type>` 163 +2 - Sử dụng **`Rx`** và dùng Darts Generics, `Rx<Type>`
167 164
168 ``` dart 165 ``` dart
169 final name = Rx<String>(''); 166 final name = Rx<String>('');
@@ -178,7 +175,7 @@ final myMap = Rx<Map<String, int>>({}); @@ -178,7 +175,7 @@ final myMap = Rx<Map<String, int>>({});
178 final user = Rx<User>(); 175 final user = Rx<User>();
179 ``` 176 ```
180 177
181 -3 - The third, more practical, easier and preferred approach, just add **`.obs`** as a property of your `value` : 178 +3 - Cách tối ưu nhất, thêm **`.obs`** `value` :
182 179
183 ``` dart 180 ``` dart
184 final name = ''.obs; 181 final name = ''.obs;
@@ -193,17 +190,16 @@ final myMap = <String, int>{}.obs; @@ -193,17 +190,16 @@ final myMap = <String, int>{}.obs;
193 final user = User().obs; 190 final user = User().obs;
194 ``` 191 ```
195 192
196 -##### Having a reactive state, is easy. 193 +##### Thât dễ khi có reactive state.
197 194
198 -As we know, _Dart_ is now heading towards _null safety_.  
199 -To be prepared, from now on, you should always start your _Rx_ variables with an **initial value**. 195 +Như chúng ta biết, _Dart_ đang hướng tới _null safety_.
  196 +Để chuẩn bị, từ bây giờ, bạn phải luôn bắt đầu các biến _Rx_ của mình bằng một **initial value**.
200 197
201 > Transforming a variable into an _observable_ + _initial value_ with **GetX** is the simplest, and most practical approach. 198 > Transforming a variable into an _observable_ + _initial value_ with **GetX** is the simplest, and most practical approach.
202 199
203 -You will literally add a " `.obs` " to the end of your variable, and **that’s it**, you’ve made it observable,  
204 -and its `.value` , well, will be the _initial value_). 200 +Theo đúng nghĩa đen, bạn sẽ thêm một "` .obs` "vào cuối biến của mình và **vậy thôi người ơi~**, bạn đã làm cho nó có thể quan sát được, và `.value` của nó sẽ là _initial value_).
205 201
206 -### Using the values in the view 202 +### Sử dụng values trong View
207 203
208 ``` dart 204 ``` dart
209 // controller file 205 // controller file
@@ -234,33 +230,33 @@ GetX<Controller>( @@ -234,33 +230,33 @@ GetX<Controller>(
234 ), 230 ),
235 ``` 231 ```
236 232
237 -If we increment `count1.value++` , it will print: 233 +Nếu chúng ta cộng `count1.value++` , nó sẽ in:
238 234
239 * `count 1 rebuild` 235 * `count 1 rebuild`
240 236
241 * `count 3 rebuild` 237 * `count 3 rebuild`
242 238
243 -because `count1` has a value of `1` , and `1 + 0 = 1` , changing the `sum` getter value. 239 +bởi vì `count1` có giá trị là` 1` và `1 + 0 = 1`, thay đổi giá trị getter` sum`.
244 240
245 -If we change `count2.value++` , it will print: 241 +Nếu ta thay đổi `count2.value++` , nó sẽ in:
246 242
247 * `count 2 rebuild` 243 * `count 2 rebuild`
248 244
249 * `count 3 rebuild` 245 * `count 3 rebuild`
250 246
251 -because `count2.value` changed, and the result of the `sum` is now `2` . 247 +bởi vì `count2.value` đã thay đổi, và kết quả của` sum` bây giờ là `2`.
252 248
253 -* NOTE: By default, the very first event will rebuild the widget, even if it is the same `value`. 249 +* LƯU Ý: Theo mặc định, event đầu tiên sẽ xây dựng lại widget con, ngay cả khi nó là cùng một `giá trị`.
254 250
255 - This behavior exists due to Boolean variables. 251 +Hành vi này tồn tại do các biến Boolean.
256 252
257 -Imagine you did this: 253 +Ví dụ, bạn code thế này:
258 254
259 ``` dart 255 ``` dart
260 var isLogged = false.obs; 256 var isLogged = false.obs;
261 ``` 257 ```
262 258
263 -And then, you checked if a user is "logged in" to trigger an event in `ever` . 259 +Và sau đó, bạn đã kiểm tra xem người dùng có "đăng nhập" để kích hoạt event trong `ever` không.
264 260
265 ``` dart 261 ``` dart
266 @override 262 @override
@@ -278,16 +274,16 @@ fireRoute(logged) { @@ -278,16 +274,16 @@ fireRoute(logged) {
278 } 274 }
279 ``` 275 ```
280 276
281 -if `hasToken` was `false` , there would be no change to `isLogged` , so `ever()` would never be called.  
282 -To avoid this type of behavior, the first change to an _observable_ will always trigger an event,  
283 -even if it contains the same `.value` . 277 +nếu `hasToken` là` false`, sẽ không có thay đổi thành `isLogged`, vì vậy `ever ()` sẽ không bao giờ được gọi.
  278 +Để tránh loại hành vi này, thay đổi đầu tiên đối với _observable_ sẽ luôn kích hoạt một event,
  279 +ngay cả khi nó chứa cùng một `.value`.
284 280
285 -You can remove this behavior if you want, using: 281 +Bạn có thể xóa hành vi này nếu muốn, bằng cách sử dụng:
286 `isLogged.firstRebuild = false;` 282 `isLogged.firstRebuild = false;`
287 283
288 -### Conditions to rebuild 284 +### Điều kiện để tái tạo lại
289 285
290 -In addition, Get provides refined state control. You can condition an event (such as adding an object to a list), on a certain condition. 286 +Ngoài ra, Get cung cấp khả năng kiểm soát state đã được tinh chỉnh. Bạn có thể điều kiện một event (chẳng hạn như thêm một đối tượng vào danh sách), với một điều kiện nhất định.
291 287
292 ``` dart 288 ``` dart
293 // First parameter: condition, must return true or false. 289 // First parameter: condition, must return true or false.
@@ -295,9 +291,9 @@ In addition, Get provides refined state control. You can condition an event (suc @@ -295,9 +291,9 @@ In addition, Get provides refined state control. You can condition an event (suc
295 list.addIf(item < limit, item); 291 list.addIf(item < limit, item);
296 ``` 292 ```
297 293
298 -Without decorations, without a code generator, without complications :smile: 294 +Không có decoration, không có trình tạo mã, không có phức tạp hóa vấn đề: smile:
299 295
300 -Do you know Flutter's counter app? Your Controller class might look like this: 296 +Bạn có biết ứng dụng counter của Flutter không? Class controller của bạn có thể trông giống như sau:
301 297
302 ``` dart 298 ``` dart
303 class CountController extends GetxController { 299 class CountController extends GetxController {
@@ -305,19 +301,19 @@ class CountController extends GetxController { @@ -305,19 +301,19 @@ class CountController extends GetxController {
305 } 301 }
306 ``` 302 ```
307 303
308 -With a simple: 304 +Đơn giản hơn:
309 305
310 ``` dart 306 ``` dart
311 controller.count.value++ 307 controller.count.value++
312 ``` 308 ```
313 309
314 -You could update the counter variable in your UI, regardless of where it is stored. 310 +Bạn có thể cập nhật counter trong UI của mình, bất kể nó được lưu trữ ở đâu.
315 311
316 -### Where .obs can be used 312 +### Nơi .obs có thể dùng
317 313
318 -You can transform anything on obs. Here are two ways of doing it: 314 +Bạn có thể biến đổi bất cứ thứ gì trên obs. Đây là hai cách để làm điều đó:
319 315
320 -* You can convert your class values to obs 316 +* Bạn có thể chuyển đổi các giá trị class của mình thành obs
321 317
322 ``` dart 318 ``` dart
323 class RxUser { 319 class RxUser {
@@ -326,7 +322,7 @@ class RxUser { @@ -326,7 +322,7 @@ class RxUser {
326 } 322 }
327 ``` 323 ```
328 324
329 -* or you can convert the entire class to be an observable 325 +* hoặc bạn có thể biến cả 1 class thành observable
330 326
331 ``` dart 327 ``` dart
332 class User { 328 class User {
@@ -339,12 +335,12 @@ class User { @@ -339,12 +335,12 @@ class User {
339 final user = User(name: "Camila", age: 18).obs; 335 final user = User(name: "Camila", age: 18).obs;
340 ``` 336 ```
341 337
342 -### Note about Lists 338 +### Chí ú về Lists
343 339
344 -Lists are completely observable as are the objects within it. That way, if you add a value to a list, it will automatically rebuild the widgets that use it. 340 +List hoàn toàn có thể quan sát được cũng như các đối tượng bên trong nó. Bằng cách đó, nếu bạn thêm một giá trị vào danh sách, nó sẽ tự động xây dựng lại các widget con sử dụng nó.
345 341
346 -You also don't need to use ".value" with lists, the amazing dart api allowed us to remove that.  
347 -Unfortunaly primitive types like String and int cannot be extended, making the use of .value mandatory, but that won't be a problem if you work with gets and setters for these. 342 +Bạn cũng không cần phải sử dụng ".value" với các danh sách, api phi tiêu tuyệt vời đã cho phép chúng tôi loại bỏ điều đó.
  343 +Tiếc thay, các kiểu nguyên thủy như String và int không thể được mở rộng, khiến việc sử dụng .value là bắt buộc, nhưng điều đó sẽ không thành vấn đề nếu bạn làm việc với getters và setters cho những thứ này.
348 344
349 ``` dart 345 ``` dart
350 // On the controller 346 // On the controller
@@ -358,7 +354,7 @@ ListView.builder ( @@ -358,7 +354,7 @@ ListView.builder (
358 ) 354 )
359 ``` 355 ```
360 356
361 -When you are making your own classes observable, there is a different way to update them: 357 +Khi bạn đang làm cho các class của riêng mình có thể quan sát được, có một cách khác để cập nhật chúng:
362 358
363 ``` dart 359 ``` dart
364 // on the model file 360 // on the model file
@@ -385,32 +381,32 @@ Obx(()=> Text("Name ${user.value.name}: Age: ${user.value.age}")) @@ -385,32 +381,32 @@ Obx(()=> Text("Name ${user.value.name}: Age: ${user.value.age}"))
385 user().name; // notice that is the user variable, not the class (variable has lowercase u) 381 user().name; // notice that is the user variable, not the class (variable has lowercase u)
386 ``` 382 ```
387 383
388 -You don't have to work with sets if you don't want to. you can use the "assign 'and" assignAll "api.  
389 -The "assign" api will clear your list, and add a single object that you want to start there.  
390 -The "assignAll" api will clear the existing list and add any iterable objects that you inject into it. 384 +Bạn không cần phải làm việc với các bộ nếu bạn không muốn. bạn có thể sử dụng api "assign" và "assignAll".
  385 +Api "assign" sẽ xóa danh sách của bạn và thêm một đối tượng duy nhất mà bạn muốn bắt đầu ở đó.
  386 +Api "allowAll" sẽ xóa danh sách hiện có và thêm bất kỳ đối tượng có thể lặp lại nào mà bạn đưa vào đó.
391 387
392 -### Why i have to use .value 388 +### Tại sao tôi phải dùng .value
393 389
394 -We could remove the obligation to use 'value' to `String` and `int` with a simple decoration and code generator, but the purpose of this library is precisely avoid external dependencies. We want to offer an environment ready for programming, involving the essentials (management of routes, dependencies and states), in a simple, lightweight and performant way, without a need of an external package. 390 +Chúng ta có thể loại bỏ việc sử dụng 'value' đối với `String` và` int` bằng một trình tạo mã và decoration đơn giản, nhưng mục đích của thư viện này chính là tránh các dependency bên ngoài. Chúng tôi muốn cung cấp một môi trường sẵn sàng cho việc lập trình, liên quan đến các yếu tố cần thiết (quản lý các route, dependency và state), theo cách đơn giản, nhẹ và hiệu quả mà không cần gói bên ngoài.
395 391
396 -You can literally add 3 letters to your pubspec (get) and a colon and start programming. All solutions included by default, from route management to state management, aim at ease, productivity and performance. 392 +Theo nghĩa đen, bạn có thể thêm 3 chữ cái vào pubspec (get) của mình và dấu hai chấm và bắt đầu lập trình. Tất cả các giải pháp được bao gồm theo mặc định, từ quản lý route đến quản lý state, nhằm mục đích dễ dàng, năng suất và hiệu suất.
397 393
398 -The total weight of this library is less than that of a single state manager, even though it is a complete solution, and that is what you must understand. 394 +Tổng trọng lượng của thư viện này ít hơn của một trình quản lý state duy nhất, mặc dù nó là một giải pháp hoàn chỉnh và đó là những gì bạn phải hiểu.
399 395
400 -If you are bothered by `.value` , and like a code generator, MobX is a great alternative, and you can use it in conjunction with Get. For those who want to add a single dependency in pubspec and start programming without worrying about the version of a package being incompatible with another, or if the error of a state update is coming from the state manager or dependency, or still, do not want to worrying about the availability of controllers, whether literally "just programming", get is just perfect. 396 +Nếu bạn bị làm phiền bởi `.value`, và giống như một trình tạo mã, MobX là một giải pháp thay thế tuyệt vời và bạn có thể sử dụng nó cùng với Get. Đối với những người muốn thêm một gói dependency duy nhất vào pubspec và bắt đầu lập trình mà không cần lo lắng về phiên bản của gói không tương thích với gói khác hoặc nếu lỗi cập nhật state đến từ trình quản lý state hoặc dependency, hoặc vẫn không muốn lo lắng về sự sẵn có của controller, cho dù theo nghĩa đen là "chỉ là lập trình", GetX là lựa chọn hoàn hảo.
401 397
402 -If you have no problem with the MobX code generator, or have no problem with the BLoC boilerplate, you can simply use Get for routes, and forget that it has state manager. Get SEM and RSM were born out of necessity, my company had a project with more than 90 controllers, and the code generator simply took more than 30 minutes to complete its tasks after a Flutter Clean on a reasonably good machine, if your project it has 5, 10, 15 controllers, any state manager will supply you well. If you have an absurdly large project, and code generator is a problem for you, you have been awarded this solution. 398 +Nếu bạn không gặp vấn đề gì với trình tạo mã MobX hoặc không gặp vấn đề gì với bảng soạn sẵn BLoC, bạn có thể chỉ cần sử dụng Get cho các route và quên rằng nó có trình quản lý state. Get SEM và RSM ra đời không cần thiết, công ty của tôi có một dự án với hơn 90 controller và trình tạo mã chỉ mất hơn 30 phút để hoàn thành nhiệm vụ của nó sau khi Flutter Clean trên một máy khá tốt, nếu dự án của bạn có 5, 10, 15 controller, bất kỳ nhà quản lý state sẽ cung cấp cho bạn tốt. Nếu bạn có một dự án lớn đến mức ngớ ngẩn và trình tạo mã là một vấn đề đối với bạn, thì bạn đã được trao giải pháp này.
403 399
404 -Obviously, if someone wants to contribute to the project and create a code generator, or something similar, I will link in this readme as an alternative, my need is not the need for all devs, but for now I say, there are good solutions that already do that, like MobX. 400 +Rõ ràng, nếu ai đó muốn đóng góp vào dự án và tạo trình tạo mã, hoặc thứ gì đó tương tự, tôi sẽ liên kết trong readme này như một giải pháp thay thế, nhu cầu của tôi không phải là nhu cầu của tất cả các nhà phát triển, nhưng ý tôi là thế, đã có những giải pháp tốt đã làm được điều đó, như MobX.
405 401
406 ### Obx() 402 ### Obx()
407 403
408 -Typing in Get using Bindings is unnecessary. you can use the Obx widget instead of GetX which only receives the anonymous function that creates a widget.  
409 -Obviously, if you don't use a type, you will need to have an instance of your controller to use the variables, or use `Get.find<Controller>()` .value or Controller.to.value to retrieve the value. 404 +Nhập vào Get bằng cách sử dụng Bindings là không cần thiết. bạn có thể sử dụng widget Obx thay vì GetX, widget chỉ nhận được chức năng ẩn danh tạo widget.
  405 +Rõ ràng, nếu bạn không sử dụng một kiểu, bạn sẽ cần phải có một phiên bản của controller để sử dụng các biến hoặc sử dụng `Get.find <Controller> ()` .value hoặc Controller.to.value để truy xuất giá trị .
410 406
411 ### Workers 407 ### Workers
412 408
413 -Workers will assist you, triggering specific callbacks when an event occurs. 409 +Workers sẽ hỗ trợ bạn, kích hoạt các lệnh gọi lại cụ thể khi một event xảy ra.
414 410
415 ``` dart 411 ``` dart
416 /// Called every time `count1` changes. 412 /// Called every time `count1` changes.
@@ -426,63 +422,63 @@ debounce(count1, (_) => print("debouce$_"), time: Duration(seconds: 1)); @@ -426,63 +422,63 @@ debounce(count1, (_) => print("debouce$_"), time: Duration(seconds: 1));
426 interval(count1, (_) => print("interval $_"), time: Duration(seconds: 1)); 422 interval(count1, (_) => print("interval $_"), time: Duration(seconds: 1));
427 ``` 423 ```
428 424
429 -All workers (except `debounce` ) have a `condition` named parameter, which can be a `bool` or a callback that returns a `bool` .  
430 -This `condition` defines when the `callback` function executes. 425 +Tất cả các workers (except `debounce` ) có `condition` tham số được đặt tên, mà có thể là loại `bool` hoặc lệnh gọi lại trả về một `bool` .
  426 +`condition` này mô tả khi `callback` kích hoạt.
431 427
432 -All workers returns a `Worker` instance, that you can use to cancel ( via `dispose()` ) the worker. 428 +Tất cả các workers đều trả về trường hợp `Worker`, mà bạn có thể đóng ( thông qua `dispose()` ) của worker.
433 429
434 430
435 * **`ever`** 431 * **`ever`**
436 432
437 - is called every time the _Rx_ variable emits a new value. 433 + được gọi mỗi khi biến _Rx_ tạo ra một giá trị mới.
438 434
439 * **`everAll`** 435 * **`everAll`**
440 436
441 - Much like `ever` , but it takes a `List` of _Rx_ values Called every time its variable is changed. That's it. 437 +Giống như `ever`, nhưng nó có một` List` gồm các giá trị _Rx_ Được gọi mỗi khi biến của nó bị thay đổi. Chỉ vậy thôi người ơi~ 😊
442 438
443 * **`once`** 439 * **`once`**
444 440
445 -'once' is called only the first time the variable has been changed. 441 +'once' chỉ được gọi lần đầu tiên biến được thay đổi.
446 442
447 * **`debounce`** 443 * **`debounce`**
448 444
449 -'debounce' is very useful in search functions, where you only want the API to be called when the user finishes typing. If the user types "Jonny", you will have 5 searches in the APIs, by the letter J, o, n, n, and y. With Get this does not happen, because you will have a "debounce" Worker that will only be triggered at the end of typing. 445 +'debounce' rất hữu ích trong các hàm tìm kiếm, nơi bạn chỉ muốn API được gọi khi người dùng nhập xong. Nếu người dùng nhập "Kaiser", bạn sẽ có 6 tìm kiếm trong các API, theo ký tự K, a, i, s, e và r. Với Get, điều này không xảy ra, bởi vì bạn sẽ có một Worker "debounce" sẽ chỉ được kích hoạt khi kết thúc nhập.
450 446
451 * **`interval`** 447 * **`interval`**
452 448
453 -'interval' is different from the debouce. debouce if the user makes 1000 changes to a variable within 1 second, he will send only the last one after the stipulated timer (the default is 800 milliseconds). Interval will instead ignore all user actions for the stipulated period. If you send events for 1 minute, 1000 per second, debounce will only send you the last one, when the user stops strafing events. interval will deliver events every second, and if set to 3 seconds, it will deliver 20 events that minute. This is recommended to avoid abuse, in functions where the user can quickly click on something and get some advantage (imagine that the user can earn coins by clicking on something, if he clicked 300 times in the same minute, he would have 300 coins, using interval, you you can set a time frame for 3 seconds, and even then clicking 300 or a thousand times, the maximum he would get in 1 minute would be 20 coins, clicking 300 or 1 million times). The debounce is suitable for anti-DDos, for functions like search where each change to onChange would cause a query to your api. Debounce will wait for the user to stop typing the name, to make the request. If it were used in the coin scenario mentioned above, the user would only win 1 coin, because it is only executed, when the user "pauses" for the established time. 449 +'interval' khác với debounce. Debounce xảy ra nếu người dùng thực hiện 1000 thay đổi đối với một biến trong vòng 1 giây, y sẽ chỉ gửi biến cuối cùng sau bộ hẹn giờ quy định (mặc định là 800 mili giây). Thay vào đó, interval sẽ bỏ qua tất cả các hành động của người dùng trong interval quy định. Nếu bạn gửi event trong 1 phút, 1000 mỗi giây, tính năng gỡ lỗi sẽ chỉ gửi cho bạn event cuối cùng, khi người dùng ngừng phân chia event. interval sẽ phân phối các event mỗi giây và nếu được đặt thành 3 giây, nó sẽ phân phối 20 event trong phút đó. Điều này được khuyến nghị để tránh lạm dụng, trong các chức năng mà người dùng có thể nhanh chóng nhấp vào một thứ gì đó và có được một số lợi thế (hãy tưởng tượng rằng người dùng có thể kiếm được xu bằng cách nhấp vào thứ gì đó, nếu y nhấp 300 lần trong cùng một phút, y sẽ có 300 xu, bằng cách sử dụng interval, bạn có thể đặt khung thời gian trong 3 giây, và thậm chí sau đó nhấp vào 300 hoặc một nghìn lần, tối đa y sẽ nhận được trong 1 phút sẽ là 20 xu, nhấp 300 hoặc 1 triệu lần). Việc gỡ lỗi này phù hợp cho việc chống DDos, cho các chức năng như tìm kiếm trong đó mỗi thay đổi đối với onChange sẽ gây ra một truy vấn tới api của bạn. Debounce sẽ đợi người dùng ngừng nhập tên để thực hiện yêu cầu. Nếu nó được sử dụng trong kịch bản đồng xu được đề cập ở trên, người dùng sẽ chỉ giành được 1 đồng xu, bởi vì nó chỉ được thực thi, khi người dùng "tạm dừng" trong thời gian đã thiết lập.
454 450
455 -* NOTE: Workers should always be used when starting a Controller or Class, so it should always be on onInit (recommended), Class constructor, or the initState of a StatefulWidget (this practice is not recommended in most cases, but it shouldn't have any side effects). 451 +* CHÍ Ú: Workers phải luôn được sử dụng khi khởi động Controller hoặc Class, vì vậy nó phải luôn ở trên onInit (được khuyến nghị), phương thức khởi tạo Class hoặc initState của StatefulWidget (phương pháp này không được khuyến khích trong hầu hết các trường hợp, nhưng nó không nên có hiệu ứng phụ nào khác).
456 452
457 -## Simple State Manager 453 +## Quản lý State đơn giản
458 454
459 -Get has a state manager that is extremely light and easy, which does not use ChangeNotifier, will meet the need especially for those new to Flutter, and will not cause problems for large applications. 455 +Get có một trình quản lý state cực kỳ nhẹ và dễ dàng, không sử dụng ChangeNotifier, sẽ đáp ứng nhu cầu đặc biệt cho những người mới sử dụng Flutter và sẽ không gây ra sự cố cho các ứng dụng lớn.
460 456
461 -GetBuilder is aimed precisely at multiple state control. Imagine that you added 30 products to a cart, you click delete one, at the same time that the list is updated, the price is updated and the badge in the shopping cart is updated to a smaller number. This type of approach makes GetBuilder killer, because it groups states and changes them all at once without any "computational logic" for that. GetBuilder was created with this type of situation in mind, since for ephemeral change of state, you can use setState and you would not need a state manager for this. 457 +GetBuilder nhắm chính xác vào việc kiểm soát nhiều state. Hãy tưởng tượng rằng bạn đã thêm 30 sản phẩm vào giỏ hàng, bạn nhấp vào xóa một sản phẩm, đồng thời danh sách được cập nhật, giá được cập nhật và huy hiệu trong giỏ hàng được cập nhật thành số lượng nhỏ hơn. Kiểu tiếp cận này khiến GetBuilder trở thành kẻ giết người, bởi vì nó nhóm các state và thay đổi tất cả chúng cùng một lúc mà không có bất kỳ "logic tính toán" nào cho điều đó. GetBuilder được tạo ra với loại tình huống này, vì để thay đổi state tạm thời, bạn có thể sử dụng setState và bạn sẽ không cần trình quản lý state cho việc này.
462 458
463 -That way, if you want an individual controller, you can assign IDs for that, or use GetX. This is up to you, remembering that the more "individual" widgets you have, the more the performance of GetX will stand out, while the performance of GetBuilder should be superior, when there is multiple change of state. 459 +Bằng cách đó, nếu bạn muốn một controller riêng lẻ, bạn có thể gán ID cho controller đó hoặc sử dụng GetX. Điều này là tùy thuộc vào bạn, hãy nhớ rằng bạn càng có nhiều widget "riêng lẻ" thì hiệu suất của GetX càng nổi bật, trong khi hiệu suất của GetBuilder phải vượt trội hơn khi có nhiều thay đổi state.
464 460
465 -### Advantages 461 +### Lợi thế
466 462
467 -1. Update only the required widgets. 463 +1. Chỉ cập nhật các widget được yêu cầu.
468 464
469 -2. Does not use changeNotifier, it is the state manager that uses less memory (close to 0mb). 465 +2. Không sử dụng changeNotifier, đó là trình quản lý state sử dụng ít bộ nhớ hơn (gần như bằng 0mb).
470 466
471 -3. Forget StatefulWidget! With Get you will never need it. With the other state managers, you will probably have to use a StatefulWidget to get the instance of your Provider, BLoC, MobX Controller, etc. But have you ever stopped to think that your appBar, your scaffold, and most of the widgets that are in your class are stateless? So why save the state of an entire class, if you can only save the state of the Widget that is stateful? Get solves that, too. Create a Stateless class, make everything stateless. If you need to update a single component, wrap it with GetBuilder, and its state will be maintained. 467 +3. Quên StatefulWidget! Với Get, bạn sẽ không bao giờ cần đến nó. Với các trình quản lý state khác, bạn có thể sẽ phải sử dụng StatefulWidget để lấy phiên bản của Provider, BLoC, MobX, v.v. Nhưng bạn đã bao giờ nghĩ rằng AppBar, Scaffole và hầu hết các widget trong class của bạn là stateless? Vậy tại sao phải lưu state của toàn bộ class, nếu bạn chỉ có thể lưu state của Widget là stateful? Get giải quyết được điều đó bằng cách tạo một class Stateless, làm cho mọi thứ trở nên vô trạng. Nếu bạn cần cập nhật một thành phần riêng lẻ, hãy bọc nó bằng GetBuilder và state của nó sẽ được duy trì.
472 468
473 -4. Organize your project for real! Controllers must not be in your UI, place your TextEditController, or any controller you use within your Controller class. 469 +4. Tái cơ cấu cho dự án của bạn xanh, sạch và đẹp! Controller không được nằm trong UI của bạn, hãy đặt TextEditController của bạn hoặc bất kỳ controller nào bạn sử dụng trong class Controller của mình.
474 470
475 -5. Do you need to trigger an event to update a widget as soon as it is rendered? GetBuilder has the property "initState", just like StatefulWidget, and you can call events from your controller, directly from it, no more events being placed in your initState. 471 +5. Bạn có cần kích hoạt event để cập nhật widget con ngay khi nó được hiển thị không? GetBuilder có thuộc tính "initState", giống như StatefulWidget và bạn có thể gọi các event từ controller của mình, trực tiếp từ nó, không có thêm event nào được đặt trong initState của bạn.
476 472
477 -6. Do you need to trigger an action like closing streams, timers and etc? GetBuilder also has the dispose property, where you can call events as soon as that widget is destroyed. 473 +6. Bạn có cần phải kích hoạt một hành động như đóng streams, hẹn giờ, v.v. không? GetBuilder cũng có dispose property, nơi bạn có thể gọi các event ngay khi widget đó bị phá hủy.
478 474
479 -7. Use streams only if necessary. You can use your StreamControllers inside your controller normally, and use StreamBuilder also normally, but remember, a stream reasonably consumes memory, reactive programming is beautiful, but you shouldn't abuse it. 30 streams open simultaneously can be worse than changeNotifier (and changeNotifier is very bad). 475 +7. Chỉ sử dụng các streams nếu cần thiết. Bạn có thể sử dụng StreamControllers bên trong controller của mình một cách bình thường và sử dụng StreamBuilder cũng bình thường, nhưng hãy nhớ rằng, một streams tiêu thụ bộ nhớ một kha khá, lập trình phản ứng rất đẹp, nhưng bạn không nên lạm dụng nó. 30 streams mở cùng lúc có thể tệ hơn changeNotifier (và changeNotifier đã rất là tệ).
480 476
481 -8. Update widgets without spending ram for that. Get stores only the GetBuilder creator ID, and updates that GetBuilder when necessary. The memory consumption of the get ID storage in memory is very low even for thousands of GetBuilders. When you create a new GetBuilder, you are actually sharing the state of GetBuilder that has a creator ID. A new state is not created for each GetBuilder, which saves A LOT OF ram for large applications. Basically your application will be entirely Stateless, and the few Widgets that will be Stateful (within GetBuilder) will have a single state, and therefore updating one will update them all. The state is just one. 477 +8. Cập nhật các widgets mà không tốn ram. Chỉ lưu trữ ID người tạo GetBuilder và cập nhật GetBuilder đó khi cần thiết. Mức tiêu thụ bộ nhớ của get ID trong bộ nhớ là rất thấp ngay cả đối với hàng nghìn GetBuilders. Khi bạn tạo GetBuilder mới, bạn thực sự đang chia sẻ state GetBuilder có ID người tạo. Một state mới không được tạo cho mỗi GetBuilder, giúp tiết kiệm RẤT NHIỀU ram cho các ứng dụng lớn. Về cơ bản, ứng dụng của bạn sẽ hoàn toàn là Không state và một số ít Tiện ích sẽ có state (trong GetBuilder) sẽ có một state duy nhất, và do đó cập nhật một sẽ cập nhật tất cả. Nhà nước chỉ là một.
482 478
483 -9. Get is omniscient and in most cases it knows exactly the time to take a controller out of memory. You should not worry about when to dispose of a controller, Get knows the best time to do this. 479 +9. Get là toàn trí và trong hầu hết các trường hợp, nó biết chính xác thời gian để lấy controller ra khỏi bộ nhớ. Bạn không nên lo lắng về việc khi nào nên vứt bỏ controller, Get biết thời điểm tốt nhất để thực hiện việc này.
484 480
485 -### Usage 481 +### Sử dụng
486 482
487 ``` dart 483 ``` dart
488 // Create controller class and extends GetxController 484 // Create controller class and extends GetxController
@@ -503,13 +499,13 @@ GetBuilder<Controller>( @@ -503,13 +499,13 @@ GetBuilder<Controller>(
503 //Initialize your controller only the first time. The second time you are using ReBuilder for the same controller, do not use it again. Your controller will be automatically removed from memory as soon as the widget that marked it as 'init' is deployed. You don't have to worry about that, Get will do it automatically, just make sure you don't start the same controller twice. 499 //Initialize your controller only the first time. The second time you are using ReBuilder for the same controller, do not use it again. Your controller will be automatically removed from memory as soon as the widget that marked it as 'init' is deployed. You don't have to worry about that, Get will do it automatically, just make sure you don't start the same controller twice.
504 ``` 500 ```
505 501
506 -**Done!** 502 +**OK, giải thích xong rồi!**
507 503
508 -* You have already learned how to manage states with Get. 504 +* Bạn đã học cách quản lý state với Get.
509 505
510 -* Note: You may want a larger organization, and not use the init property. For that, you can create a class and extends Bindings class, and within it mention the controllers that will be created within that route. Controllers will not be created at that time, on the contrary, this is just a statement, so that the first time you use a Controller, Get will know where to look. Get will remain lazyLoad, and will continue to dispose Controllers when they are no longer needed. See the pub.dev example to see how it works. 506 +* Lưu ý: Bạn có thể muốn một tổ chức lớn hơn và không sử dụng thuộc tính init. Vì vậy, bạn có thể tạo một class và mở rộng class Bindings và trong đó đề cập đến các controller sẽ được tạo trong route đó. Khi đó các Controllers sẽ không được tạo, ngược lại, đây chỉ là một câu lệnh, để lần đầu sử dụng Controller, Get sẽ biết cần tìm ở đâu. Get sẽ vẫn là lazyLoad và sẽ tiếp tục loại bỏ Controller khi chúng không còn cần thiết nữa. Hãy xem ví dụ pub.dev để xem nó hoạt động như thế nào.
511 507
512 -If you navigate many routes and need data that was in your previously used controller, you just need to use GetBuilder Again (with no init): 508 +Nếu bạn điều hướng nhiều route và cần dữ liệu trong controller đã sử dụng trước đó, bạn chỉ cần sử dụng GetBuilder Again (không có init):
513 509
514 ``` dart 510 ``` dart
515 class OtherClass extends StatelessWidget { 511 class OtherClass extends StatelessWidget {
@@ -526,7 +522,7 @@ class OtherClass extends StatelessWidget { @@ -526,7 +522,7 @@ class OtherClass extends StatelessWidget {
526 522
527 ``` 523 ```
528 524
529 -If you need to use your controller in many other places, and outside of GetBuilder, just create a get in your controller and have it easily. (or use `Get.find<Controller>()` ) 525 +Nếu bạn cần sử dụng controller của mình ở nhiều nơi khác và bên ngoài GetBuilder, chỉ cần tạo quyền truy cập vào controller của bạn và có nó một cách dễ dàng. (hoặc sử dụng `Get.find <Controller> ()`)
530 526
531 ``` dart 527 ``` dart
532 class Controller extends GetxController { 528 class Controller extends GetxController {
@@ -545,7 +541,7 @@ class Controller extends GetxController { @@ -545,7 +541,7 @@ class Controller extends GetxController {
545 } 541 }
546 ``` 542 ```
547 543
548 -And then you can access your controller directly, that way: 544 +Sau đó, truy cập thẳng vào controller của bạn:
549 545
550 ``` dart 546 ``` dart
551 FloatingActionButton( 547 FloatingActionButton(
@@ -556,24 +552,24 @@ FloatingActionButton( @@ -556,24 +552,24 @@ FloatingActionButton(
556 ), 552 ),
557 ``` 553 ```
558 554
559 -When you press FloatingActionButton, all widgets that are listening to the 'counter' variable will be updated automatically. 555 +Khi bạn nhấn FloatingActionButton, tất cả các widget đang lắng nghe biến 'counter' sẽ được cập nhật tự động.
560 556
561 -### How it handles controllers 557 +### Cách GetX sử dụng controllers
562 558
563 -Let's say we have this: 559 +Ví dụ:
564 560
565 `Class a => Class B (has controller X) => Class C (has controller X)` 561 `Class a => Class B (has controller X) => Class C (has controller X)`
566 562
567 -In class A the controller is not yet in memory, because you have not used it yet (Get is lazyLoad). In class B you used the controller, and it entered memory. In class C you used the same controller as in class B, Get will share the state of controller B with controller C, and the same controller is still in memory. If you close screen C and screen B, Get will automatically take controller X out of memory and free up resources, because Class a is not using the controller. If you navigate to B again, controller X will enter memory again, if instead of going to class C, you return to class A again, Get will take the controller out of memory in the same way. If class C didn't use the controller, and you took class B out of memory, no class would be using controller X and likewise it would be disposed of. The only exception that can mess with Get, is if you remove B from the route unexpectedly, and try to use the controller in C. In this case, the creator ID of the controller that was in B was deleted, and Get was programmed to remove it from memory every controller that has no creator ID. If you intend to do this, add the "autoRemove: false" flag to class B's GetBuilder and use adoptID = true; in class C's GetBuilder. 563 +Trong class A, controller chưa có trong bộ nhớ, vì bạn chưa sử dụng nó (Get là lazyLoad). Trong class B, bạn đã sử dụng controller và nó đã vào bộ nhớ. Trong class C, bạn đã sử dụng cùng một controller như trong class B, Get sẽ chia sẻ state của controller B với controller C, và controller tương tự vẫn còn trong bộ nhớ. Nếu bạn đóng màn hình C và màn hình B, Get sẽ tự động lấy controller X ra khỏi bộ nhớ và giải phóng tài nguyên, vì Class A không sử dụng controller. Nếu bạn điều hướng đến B một lần nữa, controller X sẽ nhập lại bộ nhớ, nếu thay vì đi đến class C, bạn quay lại class A một lần nữa, Get sẽ đưa controller ra khỏi bộ nhớ theo cách tương tự. Nếu class C không sử dụng controller và bạn đã lấy class B ra khỏi bộ nhớ, thì sẽ không có class nào sử dụng controller X và tương tự như vậy, nó sẽ bị loại bỏ. Ngoại lệ duy nhất có thể gây rắc rối với Get là nếu bạn xóa B khỏi route một cách bất ngờ và cố gắng sử dụng controller trong C. Trong trường hợp này, ID người tạo của controller ở B đã bị xóa và Get được lập trình để xóa nó khỏi bộ nhớ mọi controller không có ID người tạo. Nếu bạn dự định làm điều này, hãy thêm flag "autoRemove: false" vào GetBuilder của class B và sử dụng adoptID = true trong GetBuilder của class C.
568 564
569 -### You won't need StatefulWidgets anymore 565 +### Không cần StatefulWidget nữa!
570 566
571 -Using StatefulWidgets means storing the state of entire screens unnecessarily, even because if you need to minimally rebuild a widget, you will embed it in a Consumer/Observer/BlocProvider/GetBuilder/GetX/Obx, which will be another StatefulWidget.  
572 -The StatefulWidget class is a class larger than StatelessWidget, which will allocate more RAM, and this may not make a significant difference between one or two classes, but it will most certainly do when you have 100 of them!  
573 -Unless you need to use a mixin, like TickerProviderStateMixin, it will be totally unnecessary to use a StatefulWidget with Get. 567 +Sử dụng StatefulWidgets có nghĩa là lưu trữ state của toàn bộ màn hình một cách không cần thiết, ngay cả khi bạn cần xây dựng lại một cách tối thiểu widget, bạn sẽ nhúng nó vào Consumer / Observer / BlocProvider / GetBuilder / GetX / Obx, đây sẽ là một StatefulWidget khác.
  568 +Class StatefulWidget là một class lớn hơn StatelessWidget, class này sẽ phân bổ nhiều RAM hơn và điều này có thể không tạo ra sự khác biệt đáng kể giữa một hoặc hai class, nhưng chắc chắn nó sẽ làm được khi bạn có 100 class trong số chúng!
  569 +Trừ khi bạn cần sử dụng một mixin, như TickerProviderStateMixin, thì việc sử dụng StatefulWidget với Get là hoàn toàn không cần thiết.
574 570
575 -You can call all methods of a StatefulWidget directly from a GetBuilder.  
576 -If you need to call initState() or dispose() method for example, you can call them directly; 571 +Bạn có thể gọi trực tiếp tất cả các phương thức của StatefulWidget từ GetBuilder.
  572 +Nếu bạn cần gọi phương thức initState () hoặc dispose () chẳng hạn, bạn có thể gọi chúng trực tiếp;
577 573
578 ``` dart 574 ``` dart
579 GetBuilder<Controller>( 575 GetBuilder<Controller>(
@@ -583,7 +579,7 @@ GetBuilder<Controller>( @@ -583,7 +579,7 @@ GetBuilder<Controller>(
583 ), 579 ),
584 ``` 580 ```
585 581
586 -A much better approach than this is to use the onInit() and onClose() method directly from your controller. 582 +Một cách tiếp cận tốt hơn nhiều so với cách này là sử dụng phương thức onInit () và onClose () trực tiếp từ controller của bạn.
587 583
588 ``` dart 584 ``` dart
589 @override 585 @override
@@ -593,17 +589,17 @@ void onInit() { @@ -593,17 +589,17 @@ void onInit() {
593 } 589 }
594 ``` 590 ```
595 591
596 -* NOTE: If you want to start a method at the moment the controller is called for the first time, you DON'T NEED to use constructors for this, in fact, using a performance-oriented package like Get, this borders on bad practice, because it deviates from the logic in which the controllers are created or allocated (if you create an instance of this controller, the constructor will be called immediately, you will be populating a controller before it is even used, you are allocating memory without it being in use, this definitely hurts the principles of this library). The onInit() methods; and onClose(); were created for this, they will be called when the Controller is created, or used for the first time, depending on whether you are using Get.lazyPut or not. If you want, for example, to make a call to your API to populate data, you can forget about the old-fashioned method of initState/dispose, just start your call to the api in onInit, and if you need to execute any command like closing streams, use the onClose() for that. 592 +* CHÍ Ú: Nếu bạn muốn bắt đầu một phương thức tại thời điểm controller được gọi lần đầu tiên, bạn KHÔNG CẦN sử dụng các hàm tạo cho việc này, trên thực tế, bằng cách sử dụng gói hướng hiệu suất như Get, điều này không phù hợp với thực tiễn xấu, bởi vì nó lệch khỏi logic trong đó controller được tạo hoặc chỉ định (nếu bạn tạo một phiên bản của controller này, hàm tạo sẽ được gọi ngay lập tức, bạn sẽ điền controller trước khi nó được sử dụng, bạn đang cấp phát bộ nhớ mà không sử dụng nó , điều này chắc chắn làm hỏng các nguyên tắc của thư viện này). Các phương thức onInit(); và onClose(); được tạo ra cho mục đích này, chúng sẽ được gọi khi Controller được tạo hoặc được sử dụng lần đầu tiên, tùy thuộc vào việc bạn có đang sử dụng Get.lazyPut hay không. Ví dụ: nếu bạn muốn thực hiện lệnh gọi tới API của mình để điền dữ liệu, bạn có thể quên phương thức cũ của initState / dispose, chỉ cần bắt đầu lệnh gọi tới api trong onInit. Nếu bạn cần thực thi bất kỳ lệnh nào, như đóng streams, hãy sử dụng onClose() cho việc đó.
597 593
598 -### Why it exists 594 +### Tại sao GetX tồn tại?
599 595
600 -The purpose of this package is precisely to give you a complete solution for navigation of routes, management of dependencies and states, using the least possible dependencies, with a high degree of decoupling. Get engages all high and low level Flutter APIs within itself, to ensure that you work with the least possible coupling. We centralize everything in a single package, to ensure that you don't have any kind of coupling in your project. That way, you can put only widgets in your view, and leave the part of your team that works with the business logic free, to work with the business logic without depending on any element of the View. This provides a much cleaner working environment, so that part of your team works only with widgets, without worrying about sending data to your controller, and part of your team works only with the business logic in its breadth, without depending on no element of the view. 596 +Mục đích của gói này chính xác là cung cấp cho bạn một giải pháp hoàn chỉnh để điều hướng các route, quản lý các dependency và state, sử dụng các dependency ít nhất có thể, với mức độ tách biệt cao. Nhận tất cả các API Flutter cấp cao và cấp thấp trong chính nó, để đảm bảo rằng bạn làm việc với ít khớp nối nhất có thể. Chúng tôi tập trung mọi thứ trong một gói duy nhất, để đảm bảo rằng bạn không có bất kỳ loại khớp nối nào trong dự án của mình. Bằng cách đó, bạn có thể chỉ đặt các widget trong chế độ xem của mình và để phần của nhóm làm việc với logic nghiệp vụ tự do làm việc với logic nghiệp vụ độc lập với View. Điều này cung cấp một môi trường làm việc sạch hơn nhiều, để một phần nhóm của bạn chỉ hoạt động với các widget mà không phải lo lắng về việc gửi dữ liệu đến controller của bạn và một phần nhóm của bạn chỉ làm việc với logic nghiệp vụ trong phạm vi bề rộng của nó mà không dependency vào bất kỳ yếu tố View.
601 597
602 -So to simplify this:  
603 -You don't need to call methods in initState and send them by parameter to your controller, nor use your controller constructor for that, you have the onInit() method that is called at the right time for you to start your services.  
604 -You do not need to call the device, you have the onClose() method that will be called at the exact moment when your controller is no longer needed and will be removed from memory. That way, leave views for widgets only, refrain from any kind of business logic from it. 598 +Vì vậy, để đơn giản hóa điều này:
  599 +Bạn không cần gọi các phương thức trong initState và gửi chúng theo tham số đến controller của mình, cũng như không sử dụng phương thức khởi tạo controller cho việc đó, bạn có phương thức onInit() được gọi vào đúng thời điểm để bạn khởi động các dịch vụ của mình.
  600 +Bạn không cần phải gọi thiết bị, bạn có phương thức onClose() sẽ được gọi vào thời điểm chính xác khi controller của bạn không còn cần thiết nữa và sẽ bị xóa khỏi bộ nhớ. Bằng cách đó, chỉ để lại chế độ xem cho các widget, tránh bất kỳ loại logic nghiệp vụ nào từ nó.
605 601
606 -Do not call a dispose method inside GetxController, it will not do anything, remember that the controller is not a Widget, you should not "dispose" it, and it will be automatically and intelligently removed from memory by Get. If you used any stream on it and want to close it, just insert it into the close method. Example: 602 +Đừng gọi một phương thức vứt bỏ bên trong GetxController, nó sẽ không làm được gì cả, hãy nhớ rằng controller không phải là một Widget, bạn không nên "vứt bỏ" nó, và nó sẽ được Get tự động và thông minh xóa khỏi bộ nhớ. Nếu bạn đã sử dụng bất kỳ streams nào trên đó và muốn đóng streams đó, chỉ cần chèn streams đó vào phương thức đóng. Thí dụ:
607 603
608 ``` dart 604 ``` dart
609 class Controller extends GetxController { 605 class Controller extends GetxController {
@@ -620,15 +616,15 @@ class Controller extends GetxController { @@ -620,15 +616,15 @@ class Controller extends GetxController {
620 } 616 }
621 ``` 617 ```
622 618
623 -Controller life cycle: 619 +Vòng đời của controller:
624 620
625 -* onInit() where it is created.  
626 -* onClose() where it is closed to make any changes in preparation for the delete method  
627 -* deleted: you do not have access to this API because it is literally removing the controller from memory. It is literally deleted, without leaving any trace. 621 +* onInit() nơi nó được tạo.
  622 +* onClose() nơi nó được đóng để thực hiện bất kỳ thay đổi nào nhằm chuẩn bị cho phương thức xóa
  623 +* deleted: bạn không có quyền truy cập vào API này vì nó sẽ xóa controller khỏi bộ nhớ theo đúng nghĩa đen. Nó được xóa theo đúng nghĩa đen, mà không để lại bất kỳ dấu vết nào.
628 624
629 -### Other ways of using it 625 +### Cách sử dụng khác
630 626
631 -You can use Controller instance directly on GetBuilder value: 627 +Bạn có thể sử dụng phiên bản Controller trực tiếp trên giá trị GetBuilder:
632 628
633 ``` dart 629 ``` dart
634 GetBuilder<Controller>( 630 GetBuilder<Controller>(
@@ -639,7 +635,7 @@ GetBuilder<Controller>( @@ -639,7 +635,7 @@ GetBuilder<Controller>(
639 ), 635 ),
640 ``` 636 ```
641 637
642 -You may also need an instance of your controller outside of your GetBuilder, and you can use these approaches to achieve this: 638 +Bạn cũng có thể cần một phiên bản của controller bên ngoài GetBuilder và bạn có thể sử dụng các phương pháp này để đạt được điều này:
643 639
644 ``` dart 640 ``` dart
645 class Controller extends GetxController { 641 class Controller extends GetxController {
@@ -671,7 +667,7 @@ GetBuilder<Controller>( @@ -671,7 +667,7 @@ GetBuilder<Controller>(
671 ), 667 ),
672 ``` 668 ```
673 669
674 -* You can use "non-canonical" approaches to do this. If you are using some other dependency manager, like get_it, modular, etc., and just want to deliver the controller instance, you can do this: 670 +* Bạn có thể sử dụng các phương pháp tiếp cận "không chuẩn" để thực hiện việc này. Nếu bạn đang sử dụng một số trình quản lý dependency khác, như get_it, modular, v.v. và chỉ muốn cung cấp phiên bản controller, bạn có thể thực hiện điều này:
675 671
676 ``` dart 672 ``` dart
677 Controller controller = Controller(); 673 Controller controller = Controller();
@@ -685,9 +681,9 @@ GetBuilder<Controller>( @@ -685,9 +681,9 @@ GetBuilder<Controller>(
685 681
686 ``` 682 ```
687 683
688 -### Unique IDs 684 +### IDs độc nhất
689 685
690 -If you want to refine a widget's update control with GetBuilder, you can assign them unique IDs: 686 +Nếu bạn muốn tinh chỉnh kiểm soát cập nhật của widget con với GetBuilder, bạn có thể gán cho chúng các ID độc:
691 687
692 ``` dart 688 ``` dart
693 GetBuilder<Controller>( 689 GetBuilder<Controller>(
@@ -699,44 +695,43 @@ GetBuilder<Controller>( @@ -699,44 +695,43 @@ GetBuilder<Controller>(
699 ), 695 ),
700 ``` 696 ```
701 697
702 -And update it this form: 698 +Và cập nhật nó vào biểu mẫu này:
703 699
704 ``` dart 700 ``` dart
705 update(['text']); 701 update(['text']);
706 ``` 702 ```
707 703
708 -You can also impose conditions for the update: 704 +Bạn cũng có thể áp đặt các điều kiện cho bản cập nhật:
709 705
710 ``` dart 706 ``` dart
711 update(['text'], counter < 10); 707 update(['text'], counter < 10);
712 ``` 708 ```
713 709
714 -GetX does this automatically and only reconstructs the widget that uses the exact variable that was changed, if you change a variable to the same as the previous one and that does not imply a change of state , GetX will not rebuild the widget to save memory and CPU cycles (3 is being displayed on the screen, and you change the variable to 3 again. In most state managers, this will cause a new rebuild, but with GetX the widget will only is rebuilt again, if in fact his state has changed). 710 +GetX thực hiện điều này tự động và chỉ cấu trúc lại widget con sử dụng biến chính xác đã được thay đổi, nếu bạn thay đổi một biến thành giống với biến trước đó và điều đó không ngụ ý thay đổi state, GetX sẽ không xây dựng lại widget con để tiết kiệm bộ nhớ và Chu kỳ CPU ( 3 đang được hiển thị trên màn hình và bạn lại thay đổi biến thành 3. Trong hầu hết các trình quản lý state, điều này sẽ gây ra việc xây dựng lại mới, nhưng với GetX, widget sẽ chỉ được xây dựng lại, nếu trên thực tế state của nó đã thay đổi ).
715 711
716 -## Mixing the two state managers 712 +## Trộn hai trình quản lý state
717 713
718 -Some people opened a feature request, as they wanted to use only one type of reactive variable, and the other mechanics, and needed to insert an Obx into a GetBuilder for this. Thinking about it MixinBuilder was created. It allows both reactive changes by changing ".obs" variables, and mechanical updates via update(). However, of the 4 widgets he is the one that consumes the most resources, since in addition to having a Subscription to receive change events from his children, he subscribes to the update method of his controller. 714 +Một số người đã mở một yêu cầu tính năng, vì họ chỉ muốn sử dụng một loại biến phản ứng và cơ chế khác và cần chèn Obx vào GetBuilder cho việc này. Suy nghĩ về nó MixinBuilder đã được tạo ra. Nó cho phép cả những thay đổi phản ứng bằng cách thay đổi các biến ".obs" và cập nhật thủ công thông qua update(). Tuy nhiên, trong số 4 widget, nó là widget tiêu tốn nhiều tài nguyên nhất, vì ngoài việc có Subscription để nhận các event thay đổi từ con mình, nó còn đăng ký phương thức cập nhật của controller của mình.
719 715
720 -Extending GetxController is important, as they have life cycles, and can "start" and "end" events in their onInit() and onClose() methods. You can use any class for this, but I strongly recommend you use the GetxController class to place your variables, whether they are observable or not. 716 +Việc mở rộng GetxController rất quan trọng, vì chúng có vòng đời và có thể "bắt đầu" và "kết thúc" các event trong các phương thức onInit() và onClose() của chúng. Bạn có thể sử dụng bất kỳ lớp nào cho việc này, nhưng tôi thực sự khuyên bạn nên sử dụng lớp GetxController để đặt các biến của bạn, cho dù chúng có thể quan sát được hay không.
721 717
722 ## StateMixin 718 ## StateMixin
723 719
724 -Another way to handle your `UI` state is use the `StateMixin<T>` .  
725 -To implement it, use the `with` to add the `StateMixin<T>`  
726 -to your controller which allows a T model. 720 +Một cách khác để xử lý state `UI` của bạn là sử dụng` StateMixin <T> `.
  721 +Để triển khai nó, hãy sử dụng dấu `với` để thêm` StateMixin <T> ` bộ điều khiển của bạn cho phép một mô hình T.
727 722
728 ``` dart 723 ``` dart
729 class Controller extends GetController with StateMixin<User>{} 724 class Controller extends GetController with StateMixin<User>{}
730 ``` 725 ```
731 726
732 -The `change()` method change the State whenever we want.  
733 -Just pass the data and the status in this way: 727 +Phương thức `change()` thay đổi state bất cứ khi nào chúng ta muốn.
  728 +Chỉ cần truyền dữ liệu và state theo cách này:
734 729
735 ```dart 730 ```dart
736 change(data, status: RxStatus.success()); 731 change(data, status: RxStatus.success());
737 ``` 732 ```
738 733
739 -RxStatus allow these status: 734 +RxStatus cho phép các state này:
740 735
741 ``` dart 736 ``` dart
742 RxStatus.loading(); 737 RxStatus.loading();
@@ -745,7 +740,7 @@ RxStatus.empty(); @@ -745,7 +740,7 @@ RxStatus.empty();
745 RxStatus.error('message'); 740 RxStatus.error('message');
746 ``` 741 ```
747 742
748 -To represent it in the UI, use: 743 +Để diễn tả nó trên UI, sử dụng:
749 744
750 ```dart 745 ```dart
751 class OtherClass extends GetView<Controller> { 746 class OtherClass extends GetView<Controller> {
@@ -771,19 +766,19 @@ class OtherClass extends GetView<Controller> { @@ -771,19 +766,19 @@ class OtherClass extends GetView<Controller> {
771 766
772 ## GetBuilder vs GetX vs Obx vs MixinBuilder 767 ## GetBuilder vs GetX vs Obx vs MixinBuilder
773 768
774 -In a decade working with programming I was able to learn some valuable lessons. 769 +Trong một thập kỷ làm việc với lập trình, tôi đã có thể học được một số bài học quý giá.
775 770
776 -My first contact with reactive programming was so "wow, this is incredible" and in fact reactive programming is incredible.  
777 -However, it is not suitable for all situations. Often all you need is to change the state of 2 or 3 widgets at the same time, or an ephemeral change of state, in which case reactive programming is not bad, but it is not appropriate. 771 +Lần đầu tiên tôi tiếp xúc với lập trình phản ứng là rất "Trời thần ơi, tuyệt vời ông mặt trời!" và trên thực tế, lập trình phản ứng là không thể tin được.
  772 +Tuy nhiên, nó không phải là thích hợp cho tất cả các trường hợp. Thông thường, tất cả những gì bạn cần là thay đổi state của 2 hoặc 3 widget cùng lúc, hoặc thay đổi state trong thời gian ngắn, trong trường hợp này, lập trình phản ứng không phải là xấu, nhưng nó không phù hợp.
778 773
779 -Reactive programming has a higher consumption of RAM consumption that can be compensated for by the individual workflow, which will ensure that only one widget is rebuilt and when necessary, but creating a list with 80 objects, each with several streams is not a good one idea. Open the dart inspect and check how much a StreamBuilder consumes, and you'll understand what I'm trying to tell you. 774 +Lập trình phản ứng có mức tiêu thụ RAM cao hơn có thể được bù đắp bởi quy trình làm việc riêng lẻ, điều này sẽ đảm bảo rằng chỉ một widget con được xây dựng lại và khi cần thiết, nhưng tạo danh sách với 80 đối tượng, mỗi đối tượng có nhiều streams không phải là một ý kiến hay . Mở thanh kiểm tra phi tiêu và kiểm tra xem StreamBuilder tiêu thụ bao nhiêu và bạn sẽ hiểu những gì tôi đang cố gắng nói với bạn.
780 775
781 -With that in mind, I created the simple state manager. It is simple, and that is exactly what you should demand from it: updating state in blocks in a simple way, and in the most economical way. 776 +Với ý nghĩ đó, tôi đã tạo trình quản lý state đơn giản. Nó đơn giản, và đó chính xác là những gì bạn cần ở nó: cập nhật state trong các khối theo cách đơn giản và tiết kiệm nhất.
782 777
783 -GetBuilder is very economical in RAM, and there is hardly a more economical approach than him (at least I can't imagine one, if it exists, please let us know). 778 +GetBuilder rất tiết kiệm RAM và khó có cách tiếp cận nào tiết kiệm hơn nó (ít nhất là tôi không thể tưởng tượng được, nếu đã tồn tại cách khác, vui lòng cho chúng tôi biết).
784 779
785 -However, GetBuilder is still a mechanical state manager, you need to call update() just like you would need to call Provider's notifyListeners(). 780 +Tuy nhiên, GetBuilder vẫn là một trình quản lý state cơ học, bạn cần phải gọi update () giống như bạn sẽ cần gọi tới Provider's InformListaries ().
786 781
787 -There are other situations where reactive programming is really interesting, and not working with it is the same as reinventing the wheel. With that in mind, GetX was created to provide everything that is most modern and advanced in a state manager. It updates only what is necessary and when necessary, if you have an error and send 300 state changes simultaneously, GetX will filter and update the screen only if the state actually changes. 782 +Có những tình huống khác mà lập trình phản ứng thực sự thú vị và nếu không dùng nó đồng nghĩa như đang phát minh lại cái bánh xe. Với suy nghĩ đó, GetX được tạo ra để cung cấp mọi thứ hiện đại và tiên tiến nhất trong một trình quản lý state. Nó chỉ cập nhật những gì cần thiết và khi cần thiết, nếu bạn gặp lỗi và gửi 300 state thay đổi đồng thời, GetX sẽ lọc và cập nhật màn hình chỉ khi state thực sự thay đổi.
788 783
789 -GetX is still more economical than any other reactive state manager, but it consumes a little more RAM than GetBuilder. Thinking about it and aiming to maximize the consumption of resources that Obx was created. Unlike GetX and GetBuilder, you will not be able to initialize a controller inside an Obx, it is just a Widget with a StreamSubscription that receives change events from your children, that's all. It is more economical than GetX, but loses to GetBuilder, which was to be expected, since it is reactive, and GetBuilder has the most simplistic approach that exists, of storing a widget's hashcode and its StateSetter. With Obx you don't need to write your controller type, and you can hear the change from multiple different controllers, but it needs to be initialized before, either using the example approach at the beginning of this readme, or using the Bindings class. 784 +GetX vẫn tiết kiệm hơn bất kỳ trình quản lý state phản ứng nào khác, nhưng nó tiêu tốn nhiều RAM hơn GetBuilder một chút. Suy nghĩ về điều đó và hướng tới việc tiêu thụ tối đa tài nguyên mà Obx đã tạo ra. Không giống như GetX và GetBuilder, bạn sẽ không thể khởi tạo controller bên trong Obx, nó chỉ là một Widget với StreamSubscription nhận các event thay đổi từ con bạn, vậy thôi. Nó tiết kiệm hơn GetX, nhưng thua GetBuilder, điều được mong đợi, vì nó có tính phản ứng và GetBuilder có cách tiếp cận đơn giản nhất tồn tại, đó là lưu trữ hashCode của widget con và StateSetter của nó. Với Obx, bạn không cần phải viết loại controller của mình và bạn có thể nghe thấy sự thay đổi từ nhiều controller khác nhau, nhưng nó cần được khởi tạo trước đó, sử dụng phương pháp ví dụ ở đầu readme này hoặc sử dụng class Bindings.