Renat Fakhrutdinov
Committed by GitHub

Merge pull request #11 from jonataslaw/master

update
Showing 48 changed files with 497 additions and 316 deletions
@@ -12,6 +12,29 @@ assignees: jonataslaw @@ -12,6 +12,29 @@ assignees: jonataslaw
12 **Describe the bug** 12 **Describe the bug**
13 A clear and concise description of what the bug is. 13 A clear and concise description of what the bug is.
14 14
  15 +**Reproduction code
  16 +NOTE: THIS IS MANDATORY, IF YOUR ISSUE DOES NOT CONTAIN IT, IT WILL BE CLOSED PRELIMINARY)**
  17 +
  18 +example:
  19 +
  20 +```dart
  21 +void main() => runApp(MaterialApp(home: Home()));
  22 +
  23 +class Home extends StatelessWidget {
  24 + final count = 0.obs;
  25 + @override
  26 + Widget build(context) => Scaffold(
  27 + appBar: AppBar(title: Text("counter")),
  28 + body: Center(
  29 + child: Obx(() => Text("$count")),
  30 + ),
  31 + floatingActionButton: FloatingActionButton(
  32 + child: Icon(Icons.add),
  33 + onPressed: () => count.value++,
  34 + ));
  35 +}
  36 +```
  37 +
15 **To Reproduce** 38 **To Reproduce**
16 Steps to reproduce the behavior: 39 Steps to reproduce the behavior:
17 1. Go to '...' 40 1. Go to '...'
@@ -219,7 +219,7 @@ void main() { @@ -219,7 +219,7 @@ void main() {
219 Send data on route name 219 Send data on route name
220 220
221 ```dart 221 ```dart
222 -Get.toNamed("/second/34954"); 222 +Get.toNamed("/profile/34954");
223 ``` 223 ```
224 224
225 On second screen take the data by parameter 225 On second screen take the data by parameter
@@ -357,7 +357,7 @@ class User() { @@ -357,7 +357,7 @@ class User() {
357 // on the controller file 357 // on the controller file
358 final user = User().obs; 358 final user = User().obs;
359 // when you need to update the user variable: 359 // when you need to update the user variable:
360 -user.update( (user) { // this parameter is the class itself taht you want to update 360 +user.update( (user) { // this parameter is the class itself that you want to update
361 user.name = 'Jonny'; 361 user.name = 'Jonny';
362 user.age = 18; 362 user.age = 18;
363 }); 363 });
  1 +## [3.12.1]
  2 +- Remove spaces whitespaces from dart files
  3 +
  4 +## [3.12.0]
  5 +- Added BottomSheet Duration && Export SingleGetTickerProvider (@unacorbatanegra)
  6 +- Improve docs from dependencies management (@ngxingyu)
  7 +- Fix unknownRoute with null Custom Transition (@marcosfons)
  8 +- Optimize capitalize method (@zl910627)
  9 +- Added Chinese documentation (@idootop)
  10 +- Added TextDirection property on GetMaterialApp to improve RTL layout (@justkawal)
  11 +- Remove unnecessary files on git (@nipodemos)
  12 +- Fix tags on Get.create() and GetWidget() (@roipeker)
  13 +- Update mockito dependency on getTests
  14 +- Added GetStatelessWidget, a StatelessWidget base to GetWidget with lifecycle control of controllers. Note: It's a base class, you don't need change to use it or change your GetView, GetWidget StatelessWidget to It.
  15 +
1 ## [3.11.1] 16 ## [3.11.1]
2 - Fix docs 17 - Fix docs
3 18
1 -MIT License  
2 -  
3 -Copyright (c) 2019 Jonny Borges  
4 -  
5 -Permission is hereby granted, free of charge, to any person obtaining a copy  
6 -of this software and associated documentation files (the "Software"), to deal  
7 -in the Software without restriction, including without limitation the rights  
8 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
9 -copies of the Software, and to permit persons to whom the Software is  
10 -furnished to do so, subject to the following conditions:  
11 -  
12 -The above copyright notice and this permission notice shall be included in all  
13 -copies or substantial portions of the Software.  
14 -  
15 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
16 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
17 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
18 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
19 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
20 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
21 -SOFTWARE.  
1 -package getx.demo.app.example  
2 -  
3 -import io.flutter.embedding.android.FlutterActivity  
4 -  
5 -class MainActivity : FlutterActivity() {  
6 -}  
  1 +/// GetX is an extra-light and powerful multiplatform framework.
  2 +/// It combines high performance state management, intelligent dependency
  3 +/// injection, and route management in a quick and practical way.
1 library get; 4 library get;
2 5
3 export 'package:get_core/get_core.dart'; 6 export 'package:get_core/get_core.dart';
1 -library get; 1 +/// Get Instance Manager is a modern and intelligent dependency injector
  2 +/// that injects and removes dependencies seasonally.
  3 +library instance_manager;
2 4
3 export 'package:get_instance/get_instance.dart'; 5 export 'package:get_instance/get_instance.dart';
1 -library get; 1 +///Get Navigator allows you to navigate routes, open snackbars,
  2 +///dialogs and bottomsheets easily, and without the need for context.
  3 +library route_manager;
2 4
3 export 'package:get_navigation/get_navigation.dart'; 5 export 'package:get_navigation/get_navigation.dart';
1 -library get; 1 +/// Get State Manager is a light, modern and powerful state manager to Flutter
  2 +library state_manager;
2 3
3 export 'package:get_rx/get_rx.dart'; 4 export 'package:get_rx/get_rx.dart';
4 export 'package:get_state_manager/get_state_manager.dart'; 5 export 'package:get_state_manager/get_state_manager.dart';
1 -library get; 1 +/// Get utils is a set of tools that allows you to access high-level
  2 +/// APIs and obtain validation tools for Flutter and GetX
  3 +library utils;
2 4
3 export 'package:get_utils/get_utils.dart'; 5 export 'package:get_utils/get_utils.dart';
1 name: get 1 name: get
2 description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX. 2 description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX.
3 -version: 3.11.1 3 +version: 3.12.1
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
  1 +## [3.12.0]
  2 +* Bump to Get 3.12.0
  3 +
1 ## [3.10.2] 4 ## [3.10.2]
2 5
3 * Initial release 6 * Initial release
1 name: get_core 1 name: get_core
2 description: A base package from allow use resources from GetX™ framework. 2 description: A base package from allow use resources from GetX™ framework.
3 -version: 3.10.2 3 +version: 3.12.0
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
  1 +## [3.12.0]
  2 +* Bump to Get 3.12.0
  3 +
1 ## [3.10.2] 4 ## [3.10.2]
2 - Initial release 5 - Initial release
@@ -2,4 +2,4 @@ export 'package:get_core/get_core.dart'; @@ -2,4 +2,4 @@ export 'package:get_core/get_core.dart';
2 export 'src/bindings_interface.dart'; 2 export 'src/bindings_interface.dart';
3 export 'src/extension_instance.dart'; 3 export 'src/extension_instance.dart';
4 export 'src/get_instance.dart'; 4 export 'src/get_instance.dart';
5 -export 'src/lifecircle.dart'; 5 +export 'src/lifecycle.dart';
@@ -27,7 +27,7 @@ abstract class Bindings { @@ -27,7 +27,7 @@ abstract class Bindings {
27 /// ``` 27 /// ```
28 class BindingsBuilder<T> extends Bindings { 28 class BindingsBuilder<T> extends Bindings {
29 /// Register your dependencies in the [builder] callback. 29 /// Register your dependencies in the [builder] callback.
30 - final VoidCallback builder; 30 + final BindingBuilderCallback builder;
31 31
32 /// Shortcut to register 1 Controller with Get.put(), 32 /// Shortcut to register 1 Controller with Get.put(),
33 /// Prevents the issue of the fat arrow function with the constructor. 33 /// Prevents the issue of the fat arrow function with the constructor.
@@ -62,4 +62,4 @@ class BindingsBuilder<T> extends Bindings { @@ -62,4 +62,4 @@ class BindingsBuilder<T> extends Bindings {
62 // typedef Snack = Function(); 62 // typedef Snack = Function();
63 // typedef Modal = Function(); 63 // typedef Modal = Function();
64 // typedef Route = Function(); 64 // typedef Route = Function();
65 -typedef VoidCallback = void Function(); 65 +typedef BindingBuilderCallback = void Function();
@@ -3,7 +3,7 @@ import 'dart:collection'; @@ -3,7 +3,7 @@ import 'dart:collection';
3 3
4 import 'package:get_core/get_core.dart'; 4 import 'package:get_core/get_core.dart';
5 5
6 -import 'lifecircle.dart'; 6 +import 'lifecycle.dart';
7 7
8 class GetInstance { 8 class GetInstance {
9 factory GetInstance() => _getInstance ??= GetInstance._(); 9 factory GetInstance() => _getInstance ??= GetInstance._();
@@ -12,8 +12,6 @@ class GetInstance { @@ -12,8 +12,6 @@ class GetInstance {
12 12
13 static GetInstance _getInstance; 13 static GetInstance _getInstance;
14 14
15 - // static final config = Get();  
16 -  
17 /// Holds references to every registered Instance when using 15 /// Holds references to every registered Instance when using
18 /// [Get.put()] 16 /// [Get.put()]
19 static final Map<String, _InstanceBuilderFactory> _singl = {}; 17 static final Map<String, _InstanceBuilderFactory> _singl = {};
@@ -142,7 +140,7 @@ class GetInstance { @@ -142,7 +140,7 @@ class GetInstance {
142 /// using [Get.smartManagement] as [SmartManagement.full] or 140 /// using [Get.smartManagement] as [SmartManagement.full] or
143 /// [SmartManagement.keepFactory] 141 /// [SmartManagement.keepFactory]
144 /// Meant for internal usage of [GetPageRoute] and [GetDialogRoute] 142 /// Meant for internal usage of [GetPageRoute] and [GetDialogRoute]
145 - Future<void> removeDependencyByRoute(String routeName) async { 143 + void removeDependencyByRoute(String routeName) {
146 final keysToRemove = <String>[]; 144 final keysToRemove = <String>[];
147 _routesKey.forEach((key, value) { 145 _routesKey.forEach((key, value) {
148 if (value == routeName) { 146 if (value == routeName) {
@@ -156,7 +154,7 @@ class GetInstance { @@ -156,7 +154,7 @@ class GetInstance {
156 // assure the [DisposableInterface] instance holding a reference 154 // assure the [DisposableInterface] instance holding a reference
157 // to [onClose()] wasn't disposed. 155 // to [onClose()] wasn't disposed.
158 if (onClose != null) { 156 if (onClose != null) {
159 - await onClose(); 157 + onClose();
160 } 158 }
161 } 159 }
162 _routesByCreate[routeName].clear(); 160 _routesByCreate[routeName].clear();
@@ -164,7 +162,7 @@ class GetInstance { @@ -164,7 +162,7 @@ class GetInstance {
164 } 162 }
165 163
166 for (final element in keysToRemove) { 164 for (final element in keysToRemove) {
167 - await delete(key: element); 165 + delete(key: element);
168 } 166 }
169 167
170 for (final element in keysToRemove) { 168 for (final element in keysToRemove) {
@@ -227,26 +225,26 @@ class GetInstance { @@ -227,26 +225,26 @@ class GetInstance {
227 return i; 225 return i;
228 } 226 }
229 227
230 - // S putOrFind<S>(S Function() dep, {String tag}) {  
231 - // final key = _getKey(S, tag); 228 + S putOrFind<S>(InstanceBuilderCallback<S> dep, {String tag}) {
  229 + final key = _getKey(S, tag);
232 230
233 - // if (_singl.containsKey(key)) {  
234 - // return _singl[key].getDependency() as S;  
235 - // } else {  
236 - // if (_factory.containsKey(key)) {  
237 - // S _value = put<S>((_factory[key].builder() as S), tag: tag); 231 + if (_singl.containsKey(key)) {
  232 + return _singl[key].getDependency() as S;
  233 + } else {
  234 + if (_factory.containsKey(key)) {
  235 + final _value = put<S>((_factory[key].builder() as S), tag: tag);
238 236
239 - // if (Get.smartManagement != SmartManagement.keepFactory) {  
240 - // if (!_factory[key].fenix) {  
241 - // _factory.remove(key);  
242 - // }  
243 - // }  
244 - // return _value;  
245 - // } 237 + if (Get.smartManagement != SmartManagement.keepFactory) {
  238 + if (!_factory[key].fenix) {
  239 + _factory.remove(key);
  240 + }
  241 + }
  242 + return _value;
  243 + }
246 244
247 - // return GetInstance().put(dep(), tag: tag);  
248 - // }  
249 - // } 245 + return GetInstance().put(dep(), tag: tag);
  246 + }
  247 + }
250 248
251 /// Finds the registered type <[S]> (or [tag]) 249 /// Finds the registered type <[S]> (or [tag])
252 /// In case of using Get.[create] to register a type <[S]> or [tag], 250 /// In case of using Get.[create] to register a type <[S]> or [tag],
@@ -258,9 +256,9 @@ class GetInstance { @@ -258,9 +256,9 @@ class GetInstance {
258 if (isRegistered<S>(tag: tag)) { 256 if (isRegistered<S>(tag: tag)) {
259 if (_singl[key] == null) { 257 if (_singl[key] == null) {
260 if (tag == null) { 258 if (tag == null) {
261 - throw 'Class "$S" is not register'; 259 + throw 'Class "$S" is not registered';
262 } else { 260 } else {
263 - throw 'Class "$S" with tag "$tag" is not register'; 261 + throw 'Class "$S" with tag "$tag" is not registered';
264 } 262 }
265 } 263 }
266 264
@@ -307,16 +305,6 @@ class GetInstance { @@ -307,16 +305,6 @@ class GetInstance {
307 return true; 305 return true;
308 } 306 }
309 307
310 -// Future<bool> delete<S>({  
311 -// String tag,  
312 -// String key,  
313 -// bool force = false,  
314 -// }) async {  
315 -// final s = await queue  
316 -// .add<bool>(() async => dele<S>(tag: tag, key: key, force: force));  
317 -// return s;  
318 -// }  
319 -  
320 /// Delete registered Class Instance [S] (or [tag]) and, closes any open 308 /// Delete registered Class Instance [S] (or [tag]) and, closes any open
321 /// controllers [DisposableInterface], cleans up the memory 309 /// controllers [DisposableInterface], cleans up the memory
322 /// 310 ///
@@ -333,7 +321,13 @@ class GetInstance { @@ -333,7 +321,13 @@ class GetInstance {
333 /// - [key] For internal usage, is the processed key used to register 321 /// - [key] For internal usage, is the processed key used to register
334 /// the Instance. **don't use** it unless you know what you are doing. 322 /// the Instance. **don't use** it unless you know what you are doing.
335 /// - [force] Will delete an Instance even if marked as [permanent]. 323 /// - [force] Will delete an Instance even if marked as [permanent].
336 - Future<bool> delete<S>({String tag, String key, bool force = false}) async { 324 + bool delete<S>({String tag, String key, bool force = false}) {
  325 + // return _queue.secure<bool>(() {
  326 + return _delete<S>(tag: tag, key: key, force: force);
  327 + // });
  328 + }
  329 +
  330 + bool _delete<S>({String tag, String key, bool force = false}) {
337 final newKey = key ?? _getKey(S, tag); 331 final newKey = key ?? _getKey(S, tag);
338 332
339 if (!_singl.containsKey(newKey)) { 333 if (!_singl.containsKey(newKey)) {
@@ -356,7 +350,7 @@ class GetInstance { @@ -356,7 +350,7 @@ class GetInstance {
356 return false; 350 return false;
357 } 351 }
358 if (i is GetLifeCycle) { 352 if (i is GetLifeCycle) {
359 - await i.onClose(); 353 + i.onClose();
360 Get.log('"$newKey" onClose() called'); 354 Get.log('"$newKey" onClose() called');
361 } 355 }
362 356
1 -import 'dart:async';  
2 -  
3 /// Special callable class to keep the contract of a regular method, and avoid 1 /// Special callable class to keep the contract of a regular method, and avoid
4 /// overrides if you extend the class that uses it, as Dart has no final 2 /// overrides if you extend the class that uses it, as Dart has no final
5 /// methods. 3 /// methods.
@@ -27,7 +25,7 @@ abstract class GetLifeCycle { @@ -27,7 +25,7 @@ abstract class GetLifeCycle {
27 /// Called 1 frame after onInit(). It is the perfect place to enter 25 /// Called 1 frame after onInit(). It is the perfect place to enter
28 /// navigation events, like snackbar, dialogs, or a new route, or 26 /// navigation events, like snackbar, dialogs, or a new route, or
29 /// async request. 27 /// async request.
30 - void onReady() async {} 28 + void onReady() {}
31 29
32 /// Called before [onDelete] method. [onClose] might be used to 30 /// Called before [onDelete] method. [onClose] might be used to
33 /// dispose resources used by the controller. Like closing events, 31 /// dispose resources used by the controller. Like closing events,
@@ -35,7 +33,7 @@ abstract class GetLifeCycle { @@ -35,7 +33,7 @@ abstract class GetLifeCycle {
35 /// Or dispose objects that can potentially create some memory leaks, 33 /// Or dispose objects that can potentially create some memory leaks,
36 /// like TextEditingControllers, AnimationControllers. 34 /// like TextEditingControllers, AnimationControllers.
37 /// Might be useful as well to persist some data on disk. 35 /// Might be useful as well to persist some data on disk.
38 - FutureOr onClose() async {} 36 + void onClose() {}
39 } 37 }
40 38
41 /// Allow track difference between GetxServices and GetxControllers 39 /// Allow track difference between GetxServices and GetxControllers
1 name: get_instance 1 name: get_instance
2 description: A smart dependency injector to GetX™ framework. 2 description: A smart dependency injector to GetX™ framework.
3 -version: 3.10.2 3 +version: 3.12.0
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
  1 +## [3.12.0]
  2 +* Bump to Get 3.12.0
  3 +* Fix defaultCustomTransition
  4 +
1 ## [3.10.2] 5 ## [3.10.2]
2 6
3 - initial release 7 - initial release
@@ -753,6 +753,10 @@ extension GetNavigation on GetInterface { @@ -753,6 +753,10 @@ extension GetNavigation on GetInterface {
753 } 753 }
754 } 754 }
755 755
  756 + Future<T> showSnackbar<T>(GetBar snackbar) {
  757 + return key.currentState.push(SnackRoute<T>(snack: snackbar));
  758 + }
  759 +
756 void snackbar( 760 void snackbar(
757 String title, 761 String title,
758 String message, { 762 String message, {
@@ -802,7 +806,7 @@ extension GetNavigation on GetInterface { @@ -802,7 +806,7 @@ extension GetNavigation on GetInterface {
802 Text( 806 Text(
803 title, 807 title,
804 style: TextStyle( 808 style: TextStyle(
805 - color: colorText ?? Colors.black, 809 + color: colorText ?? theme.iconTheme.color,
806 fontWeight: FontWeight.w800, 810 fontWeight: FontWeight.w800,
807 fontSize: 16, 811 fontSize: 16,
808 ), 812 ),
@@ -811,7 +815,7 @@ extension GetNavigation on GetInterface { @@ -811,7 +815,7 @@ extension GetNavigation on GetInterface {
811 Text( 815 Text(
812 message, 816 message,
813 style: TextStyle( 817 style: TextStyle(
814 - color: colorText ?? Colors.black, 818 + color: colorText ?? theme.iconTheme.color,
815 fontWeight: FontWeight.w300, 819 fontWeight: FontWeight.w300,
816 fontSize: 14, 820 fontSize: 14,
817 ), 821 ),
@@ -912,14 +916,16 @@ extension GetNavigation on GetInterface { @@ -912,14 +916,16 @@ extension GetNavigation on GetInterface {
912 } 916 }
913 917
914 void forceAppUpdate() { 918 void forceAppUpdate() {
915 - void rebuild(Element el) {  
916 - el.markNeedsBuild();  
917 - el.visitChildren(rebuild); 919 + void restart(Element element) {
  920 + element.markNeedsBuild();
  921 + element.visitChildren(restart);
918 } 922 }
919 923
920 - (context as Element).visitChildren(rebuild); 924 + restart(Get.context as Element);
921 } 925 }
922 926
  927 + void appUpdate() => getxController.update();
  928 +
923 void changeTheme(ThemeData theme) { 929 void changeTheme(ThemeData theme) {
924 getxController.setTheme(theme); 930 getxController.setTheme(theme);
925 } 931 }
@@ -1025,8 +1031,9 @@ Since version 2.8 it is possible to access the properties @@ -1025,8 +1031,9 @@ Since version 2.8 it is possible to access the properties
1025 bool get defaultOpaqueRoute => getxController.defaultOpaqueRoute; 1031 bool get defaultOpaqueRoute => getxController.defaultOpaqueRoute;
1026 1032
1027 Transition get defaultTransition => getxController.defaultTransition; 1033 Transition get defaultTransition => getxController.defaultTransition;
  1034 +
1028 Duration get defaultTransitionDuration { 1035 Duration get defaultTransitionDuration {
1029 - return getxController.defaultDialogTransitionDuration; 1036 + return getxController.defaultTransitionDuration;
1030 } 1037 }
1031 1038
1032 Curve get defaultTransitionCurve => getxController.defaultTransitionCurve; 1039 Curve get defaultTransitionCurve => getxController.defaultTransitionCurve;
@@ -15,11 +15,12 @@ class GetMaterialController extends GetxController { @@ -15,11 +15,12 @@ class GetMaterialController extends GetxController {
15 bool defaultOpaqueRoute = true; 15 bool defaultOpaqueRoute = true;
16 16
17 Transition defaultTransition; 17 Transition defaultTransition;
18 - Duration defaultTransitionDuration = Duration(milliseconds: 400); 18 + Duration defaultTransitionDuration = Duration(milliseconds: 300);
19 Curve defaultTransitionCurve = Curves.easeOutQuad; 19 Curve defaultTransitionCurve = Curves.easeOutQuad;
20 20
21 Curve defaultDialogTransitionCurve = Curves.easeOutQuad; 21 Curve defaultDialogTransitionCurve = Curves.easeOutQuad;
22 - Duration defaultDialogTransitionDuration = Duration(milliseconds: 400); 22 +
  23 + Duration defaultDialogTransitionDuration = Duration(milliseconds: 300);
23 24
24 final routing = Routing(); 25 final routing = Routing();
25 26
@@ -132,7 +132,7 @@ class GetMaterialApp extends StatelessWidget { @@ -132,7 +132,7 @@ class GetMaterialApp extends StatelessWidget {
132 binding: unknownRoute.binding, 132 binding: unknownRoute.binding,
133 bindings: unknownRoute.bindings, 133 bindings: unknownRoute.bindings,
134 transitionDuration: 134 transitionDuration:
135 - (transitionDuration ?? unknownRoute.transitionDuration), 135 + (unknownRoute.transitionDuration ?? Get.defaultTransitionDuration),
136 transition: unknownRoute.transition, 136 transition: unknownRoute.transition,
137 popGesture: unknownRoute.popGesture, 137 popGesture: unknownRoute.popGesture,
138 fullscreenDialog: unknownRoute.fullscreenDialog, 138 fullscreenDialog: unknownRoute.fullscreenDialog,
@@ -150,7 +150,7 @@ class GetMaterialApp extends StatelessWidget { @@ -150,7 +150,7 @@ class GetMaterialApp extends StatelessWidget {
150 binding: match.route.binding, 150 binding: match.route.binding,
151 bindings: match.route.bindings, 151 bindings: match.route.bindings,
152 transitionDuration: 152 transitionDuration:
153 - (transitionDuration ?? match.route.transitionDuration), 153 + (match.route.transitionDuration ?? Get.defaultTransitionDuration),
154 transition: match.route.transition, 154 transition: match.route.transition,
155 popGesture: match.route.popGesture, 155 popGesture: match.route.popGesture,
156 fullscreenDialog: match.route.fullscreenDialog, 156 fullscreenDialog: match.route.fullscreenDialog,
@@ -171,7 +171,7 @@ class GetMaterialApp extends StatelessWidget { @@ -171,7 +171,7 @@ class GetMaterialApp extends StatelessWidget {
171 binding: match.route.binding, 171 binding: match.route.binding,
172 bindings: match.route.bindings, 172 bindings: match.route.bindings,
173 transitionDuration: 173 transitionDuration:
174 - (transitionDuration ?? match.route.transitionDuration), 174 + (match.route.transitionDuration ?? Get.defaultTransitionDuration),
175 transition: match.route.transition, 175 transition: match.route.transition,
176 popGesture: match.route.popGesture, 176 popGesture: match.route.popGesture,
177 fullscreenDialog: match.route.fullscreenDialog, 177 fullscreenDialog: match.route.fullscreenDialog,
@@ -14,7 +14,7 @@ import 'transitions_type.dart'; @@ -14,7 +14,7 @@ import 'transitions_type.dart';
14 class GetPageRoute<T> extends PageRoute<T> { 14 class GetPageRoute<T> extends PageRoute<T> {
15 GetPageRoute({ 15 GetPageRoute({
16 RouteSettings settings, 16 RouteSettings settings,
17 - this.transitionDuration = const Duration(milliseconds: 400), 17 + this.transitionDuration = const Duration(milliseconds: 300),
18 this.opaque = true, 18 this.opaque = true,
19 this.parameter, 19 this.parameter,
20 this.curve, 20 this.curve,
@@ -31,7 +31,7 @@ class GetPage { @@ -31,7 +31,7 @@ class GetPage {
31 this.alignment, 31 this.alignment,
32 this.parameter, 32 this.parameter,
33 this.opaque = true, 33 this.opaque = true,
34 - this.transitionDuration = const Duration(milliseconds: 400), 34 + this.transitionDuration,
35 this.popGesture, 35 this.popGesture,
36 this.binding, 36 this.binding,
37 this.bindings, 37 this.bindings,
@@ -195,15 +195,10 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -195,15 +195,10 @@ class GetBar<T extends Object> extends StatefulWidget {
195 /// Every other widget is ignored if this is not null. 195 /// Every other widget is ignored if this is not null.
196 final Form userInputForm; 196 final Form userInputForm;
197 197
198 - SnackRoute<T> _snackRoute;  
199 -  
200 /// Show the snack. Kicks in [SnackbarStatus.OPENING] state 198 /// Show the snack. Kicks in [SnackbarStatus.OPENING] state
201 /// followed by [SnackbarStatus.OPEN] 199 /// followed by [SnackbarStatus.OPEN]
202 - Future<T> show() async {  
203 - _snackRoute = showSnack<T>(  
204 - snack: this,  
205 - ) as SnackRoute<T>;  
206 - return await Get.key.currentState.push(_snackRoute); 200 + Future<T> show<T>() async {
  201 + return Get.key.currentState.push(SnackRoute<T>(snack: this));
207 } 202 }
208 203
209 @override 204 @override
@@ -43,7 +43,6 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -43,7 +43,6 @@ class SnackRoute<T> extends OverlayRoute<T> {
43 GetBar snack; 43 GetBar snack;
44 Builder _builder; 44 Builder _builder;
45 45
46 - Future<T> get completed => _transitionCompleter.future;  
47 final Completer<T> _transitionCompleter = Completer<T>(); 46 final Completer<T> _transitionCompleter = Completer<T>();
48 47
49 SnackbarStatusCallback _snackbarStatus; 48 SnackbarStatusCallback _snackbarStatus;
@@ -164,14 +163,11 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -164,14 +163,11 @@ class SnackRoute<T> extends OverlayRoute<T> {
164 163
165 /// The animation that drives the route's transition and the previous route's 164 /// The animation that drives the route's transition and the previous route's
166 /// forward transition. 165 /// forward transition.
167 - Animation<Alignment> get animation => _animation;  
168 Animation<Alignment> _animation; 166 Animation<Alignment> _animation;
169 167
170 /// The animation controller that the route uses to drive the transitions. 168 /// The animation controller that the route uses to drive the transitions.
171 /// 169 ///
172 /// The animation itself is exposed by the [animation] property. 170 /// The animation itself is exposed by the [animation] property.
173 - @protected  
174 - AnimationController get controller => _controller;  
175 AnimationController _controller; 171 AnimationController _controller;
176 172
177 /// Called to create the animation controller that will drive the transitions 173 /// Called to create the animation controller that will drive the transitions
@@ -235,7 +231,6 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -235,7 +231,6 @@ class SnackRoute<T> extends OverlayRoute<T> {
235 T _result; 231 T _result;
236 SnackbarStatus currentStatus; 232 SnackbarStatus currentStatus;
237 233
238 - //copy of `routes.dart`  
239 void _handleStatusChanged(AnimationStatus status) { 234 void _handleStatusChanged(AnimationStatus status) {
240 switch (status) { 235 switch (status) {
241 case AnimationStatus.completed: 236 case AnimationStatus.completed:
@@ -396,16 +391,4 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -396,16 +391,4 @@ class SnackRoute<T> extends OverlayRoute<T> {
396 391
397 /// A short description of this route useful for debugging. 392 /// A short description of this route useful for debugging.
398 String get debugLabel => '$runtimeType'; 393 String get debugLabel => '$runtimeType';
399 -  
400 - @override  
401 - String toString() => '$runtimeType(animation: $_controller)';  
402 -}  
403 -  
404 -SnackRoute showSnack<T>({@required GetBar snack}) {  
405 - assert(snack != null);  
406 -  
407 - return SnackRoute<T>(  
408 - snack: snack,  
409 - settings: RouteSettings(name: "snackbar"),  
410 - );  
411 } 394 }
1 name: get_navigation 1 name: get_navigation
2 description: Open Screens, bottomsheets, dialogs, e snackbars with no context using GetX™ framework. 2 description: Open Screens, bottomsheets, dialogs, e snackbars with no context using GetX™ framework.
3 -version: 3.10.2 3 +version: 3.12.0
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
  1 +## [3.12.0]
  2 +* Bump to Get 3.12.0
  3 +
1 ## [3.10.2] 4 ## [3.10.2]
2 - Initial release 5 - Initial release
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:collection'; 2 import 'dart:collection';
  3 +import 'package:meta/meta.dart';
  4 +
3 import '../rx_core/rx_interface.dart'; 5 import '../rx_core/rx_interface.dart';
4 part 'rx_num.dart'; 6 part 'rx_num.dart';
5 7
@@ -9,7 +11,10 @@ part 'rx_num.dart'; @@ -9,7 +11,10 @@ part 'rx_num.dart';
9 RxInterface getObs; 11 RxInterface getObs;
10 12
11 /// Base Rx class that manages all the stream logic for any Type. 13 /// Base Rx class that manages all the stream logic for any Type.
12 -class _RxImpl<T> implements RxInterface<T> { 14 +abstract class _RxImpl<T> implements RxInterface<T> {
  15 + _RxImpl(T initial) {
  16 + _value = initial;
  17 + }
13 StreamController<T> subject = StreamController<T>.broadcast(); 18 StreamController<T> subject = StreamController<T>.broadcast();
14 final _subscriptions = HashMap<Stream<T>, StreamSubscription>(); 19 final _subscriptions = HashMap<Stream<T>, StreamSubscription>();
15 20
@@ -181,9 +186,7 @@ class _RxImpl<T> implements RxInterface<T> { @@ -181,9 +186,7 @@ class _RxImpl<T> implements RxInterface<T> {
181 186
182 /// Rx class for `bool` Type. 187 /// Rx class for `bool` Type.
183 class RxBool extends _RxImpl<bool> { 188 class RxBool extends _RxImpl<bool> {
184 - RxBool([bool initial]) {  
185 - _value = initial;  
186 - } 189 + RxBool([bool initial]) : super(initial);
187 190
188 bool operator &(bool other) => other && value; 191 bool operator &(bool other) => other && value;
189 192
@@ -208,9 +211,7 @@ class RxBool extends _RxImpl<bool> { @@ -208,9 +211,7 @@ class RxBool extends _RxImpl<bool> {
208 211
209 /// Rx class for `String` Type. 212 /// Rx class for `String` Type.
210 class RxString extends _RxImpl<String> { 213 class RxString extends _RxImpl<String> {
211 - RxString([String initial]) {  
212 - _value = initial;  
213 - } 214 + RxString([String initial]) : super(initial);
214 215
215 String operator +(String val) => _value + val; 216 String operator +(String val) => _value + val;
216 } 217 }
@@ -220,9 +221,7 @@ class RxString extends _RxImpl<String> { @@ -220,9 +221,7 @@ class RxString extends _RxImpl<String> {
220 /// For example, any custom "Model" class, like User().obs will use `Rx` as 221 /// For example, any custom "Model" class, like User().obs will use `Rx` as
221 /// wrapper. 222 /// wrapper.
222 class Rx<T> extends _RxImpl<T> { 223 class Rx<T> extends _RxImpl<T> {
223 - Rx([T initial]) {  
224 - _value = initial;  
225 - } 224 + Rx([T initial]) : super(initial);
226 225
227 // TODO: Look for a way to throw the Exception with proper details when the 226 // TODO: Look for a way to throw the Exception with proper details when the
228 // value [T] doesn't implement toJson(). 227 // value [T] doesn't implement toJson().
@@ -230,6 +229,81 @@ class Rx<T> extends _RxImpl<T> { @@ -230,6 +229,81 @@ class Rx<T> extends _RxImpl<T> {
230 dynamic toJson() => (value as dynamic)?.toJson(); 229 dynamic toJson() => (value as dynamic)?.toJson();
231 } 230 }
232 231
  232 +enum RxStatus { loading, error, success }
  233 +
  234 +/// It's Experimental class, the Api can be change
  235 +abstract class RxState<T> extends _RxImpl<T> {
  236 + RxState(T initial) : super(initial) {
  237 + _fillEmptyStatus();
  238 + }
  239 +
  240 + RxStatus _status;
  241 +
  242 + bool get isNullOrEmpty {
  243 + if (_value == null) return true;
  244 + dynamic val = _value;
  245 + var result = false;
  246 + if (val is Iterable) {
  247 + result = val.isEmpty;
  248 + } else if (val is String) {
  249 + result = val.isEmpty;
  250 + } else if (val is Map) {
  251 + result = val.isEmpty;
  252 + }
  253 + return result;
  254 + }
  255 +
  256 + void _fillEmptyStatus() {
  257 + _status = isNullOrEmpty ? RxStatus.loading : RxStatus.success;
  258 + }
  259 +
  260 + RxStatus get status {
  261 + return _status;
  262 + }
  263 +
  264 + bool get isLoading => _status == RxStatus.loading;
  265 + bool get hasError => _status == RxStatus.error;
  266 + bool get hasData => _status == RxStatus.success;
  267 +
  268 + @protected
  269 + void refresh() {
  270 + subject.add(_value);
  271 + }
  272 +
  273 + @protected
  274 + void update(void fn(T val)) {
  275 + fn(_value);
  276 + subject.add(_value);
  277 + }
  278 +
  279 + @protected
  280 + T call([T v]) {
  281 + if (v != null) value = v;
  282 + return value;
  283 + }
  284 +
  285 + @protected
  286 + set value(T val) {
  287 + if (_value == val && !firstRebuild) return;
  288 + firstRebuild = false;
  289 + _value = val;
  290 + subject.add(_value);
  291 + }
  292 +
  293 + @protected
  294 + void change(T newState, {RxStatus status}) {
  295 + if (status != null) {
  296 + _status = status;
  297 + }
  298 + if (newState != _value) {
  299 + value = newState;
  300 + }
  301 + }
  302 +
  303 + @override
  304 + dynamic toJson() => (value as dynamic)?.toJson();
  305 +}
  306 +
233 extension StringExtension on String { 307 extension StringExtension on String {
234 /// Returns a `RxString` with [this] `String` as initial value. 308 /// Returns a `RxString` with [this] `String` as initial value.
235 RxString get obs => RxString(this); 309 RxString get obs => RxString(this);
1 part of 'rx_impl.dart'; 1 part of 'rx_impl.dart';
2 2
3 /// Base Rx class for all num Rx's. 3 /// Base Rx class for all num Rx's.
4 -class _BaseRxNum<T extends num> extends _RxImpl<T> { 4 +abstract class _BaseRxNum<T extends num> extends _RxImpl<T> {
  5 + _BaseRxNum(T initial) : super(initial);
  6 +
5 /// Addition operator. */ 7 /// Addition operator. */
6 8
7 /// Multiplication operator. 9 /// Multiplication operator.
@@ -267,6 +269,8 @@ class _BaseRxNum<T extends num> extends _RxImpl<T> { @@ -267,6 +269,8 @@ class _BaseRxNum<T extends num> extends _RxImpl<T> {
267 } 269 }
268 270
269 class RxNum extends _BaseRxNum<num> { 271 class RxNum extends _BaseRxNum<num> {
  272 + RxNum(num initial) : super(initial);
  273 +
270 num operator +(num other) { 274 num operator +(num other) {
271 value += other; 275 value += other;
272 return value; 276 return value;
@@ -280,9 +284,7 @@ class RxNum extends _BaseRxNum<num> { @@ -280,9 +284,7 @@ class RxNum extends _BaseRxNum<num> {
280 } 284 }
281 285
282 class RxDouble extends _BaseRxNum<double> { 286 class RxDouble extends _BaseRxNum<double> {
283 - RxDouble([double initial]) {  
284 - value = initial;  
285 - } 287 + RxDouble([double initial]) : super(initial);
286 288
287 /// Addition operator. 289 /// Addition operator.
288 RxDouble operator +(num other) { 290 RxDouble operator +(num other) {
@@ -392,9 +394,7 @@ class RxDouble extends _BaseRxNum<double> { @@ -392,9 +394,7 @@ class RxDouble extends _BaseRxNum<double> {
392 } 394 }
393 395
394 class RxInt extends _BaseRxNum<int> { 396 class RxInt extends _BaseRxNum<int> {
395 - RxInt([int initial]) {  
396 - value = initial;  
397 - } 397 + RxInt([int initial]) : super(initial);
398 398
399 /// Addition operator. 399 /// Addition operator.
400 RxInt operator +(int other) { 400 RxInt operator +(int other) {
1 name: get_rx 1 name: get_rx
2 description: A set of powerful tools to provide reactive programming for the GetX™ framework. 2 description: A set of powerful tools to provide reactive programming for the GetX™ framework.
3 -version: 3.10.2 3 +version: 3.12.0
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
  1 +## [3.12.0]
  2 +* Bump to Get 3.12.0
  3 +
1 ## [3.10.2] 4 ## [3.10.2]
2 5
3 - initial release 6 - initial release
1 -import 'dart:async';  
2 -  
3 import 'package:flutter/scheduler.dart'; 1 import 'package:flutter/scheduler.dart';
4 import 'package:get_instance/get_instance.dart'; 2 import 'package:get_instance/get_instance.dart';
5 3
@@ -37,7 +35,7 @@ abstract class DisposableInterface extends GetLifeCycle { @@ -37,7 +35,7 @@ abstract class DisposableInterface extends GetLifeCycle {
37 /// navigation events, like snackbar, dialogs, or a new route, or 35 /// navigation events, like snackbar, dialogs, or a new route, or
38 /// async request. 36 /// async request.
39 @override 37 @override
40 - void onReady() async {} 38 + void onReady() {}
41 39
42 /// Called before [onDelete] method. [onClose] might be used to 40 /// Called before [onDelete] method. [onClose] might be used to
43 /// dispose resources used by the controller. Like closing events, 41 /// dispose resources used by the controller. Like closing events,
@@ -46,5 +44,5 @@ abstract class DisposableInterface extends GetLifeCycle { @@ -46,5 +44,5 @@ abstract class DisposableInterface extends GetLifeCycle {
46 /// like TextEditingControllers, AnimationControllers. 44 /// like TextEditingControllers, AnimationControllers.
47 /// Might be useful as well to persist some data on disk. 45 /// Might be useful as well to persist some data on disk.
48 @override 46 @override
49 - FutureOr onClose() async {} 47 + void onClose() {}
50 } 48 }
@@ -6,8 +6,11 @@ import 'package:get_instance/get_instance.dart'; @@ -6,8 +6,11 @@ import 'package:get_instance/get_instance.dart';
6 import 'package:get_rx/get_rx.dart'; 6 import 'package:get_rx/get_rx.dart';
7 import '../../get_state_manager.dart'; 7 import '../../get_state_manager.dart';
8 8
  9 +typedef GetXControllerBuilder<T extends DisposableInterface> = Widget Function(
  10 + T controller);
  11 +
9 class GetX<T extends DisposableInterface> extends StatefulWidget { 12 class GetX<T extends DisposableInterface> extends StatefulWidget {
10 - final Widget Function(T) builder; 13 + final GetXControllerBuilder<T> builder;
11 final bool global; 14 final bool global;
12 15
13 // final Stream Function(T) stream; 16 // final Stream Function(T) stream;
1 import 'dart:collection'; 1 import 'dart:collection';
2 -  
3 import 'package:flutter/material.dart'; 2 import 'package:flutter/material.dart';
4 import 'package:get_core/get_core.dart'; 3 import 'package:get_core/get_core.dart';
5 import 'package:get_instance/get_instance.dart'; 4 import 'package:get_instance/get_instance.dart';
@@ -23,16 +22,14 @@ typedef GetStateUpdate = void Function(); @@ -23,16 +22,14 @@ typedef GetStateUpdate = void Function();
23 /// Avoids the potential (but extremely unlikely) issue of having 22 /// Avoids the potential (but extremely unlikely) issue of having
24 /// the Widget in a dispose() state, and abstracts the 23 /// the Widget in a dispose() state, and abstracts the
25 /// API from the ugly fn((){}). 24 /// API from the ugly fn((){}).
26 -// TODO: check performance HIT for the extra method call.  
27 mixin GetStateUpdaterMixin<T extends StatefulWidget> on State<T> { 25 mixin GetStateUpdaterMixin<T extends StatefulWidget> on State<T> {
28 // To avoid the creation of an anonym function to be GC later. 26 // To avoid the creation of an anonym function to be GC later.
29 // ignore: prefer_function_declarations_over_variables 27 // ignore: prefer_function_declarations_over_variables
30 - static final VoidCallback _stateCallback = () {};  
31 28
32 /// Experimental method to replace setState((){}); 29 /// Experimental method to replace setState((){});
33 /// Used with GetStateUpdate. 30 /// Used with GetStateUpdate.
34 void getUpdate() { 31 void getUpdate() {
35 - if (mounted) setState(_stateCallback); 32 + if (mounted) setState(() {});
36 } 33 }
37 } 34 }
38 35
@@ -123,8 +120,11 @@ class GetxController extends DisposableInterface { @@ -123,8 +120,11 @@ class GetxController extends DisposableInterface {
123 /// } 120 /// }
124 } 121 }
125 122
  123 +typedef GetControllerBuilder<T extends DisposableInterface> = Widget Function(
  124 + T controller);
  125 +
126 class GetBuilder<T extends GetxController> extends StatefulWidget { 126 class GetBuilder<T extends GetxController> extends StatefulWidget {
127 - final Widget Function(T) builder; 127 + final GetControllerBuilder<T> builder;
128 final bool global; 128 final bool global;
129 final String id; 129 final String id;
130 final String tag; 130 final String tag;
@@ -189,9 +189,10 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>> @@ -189,9 +189,10 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>>
189 controller?.onStart(); 189 controller?.onStart();
190 } 190 }
191 191
192 - if (widget.global && Get.smartManagement == SmartManagement.onlyBuilder) {  
193 - controller?.onStart();  
194 - } 192 + // if (widget.global && Get.smartManagement ==
  193 + //SmartManagement.onlyBuilder) {
  194 + // controller?.onStart();
  195 + // }
195 _subscribeToController(); 196 _subscribeToController();
196 } 197 }
197 198
@@ -269,3 +270,36 @@ class Value<T> extends GetxController { @@ -269,3 +270,36 @@ class Value<T> extends GetxController {
269 update(); 270 update();
270 } 271 }
271 } 272 }
  273 +
  274 +/// It's Experimental class, the Api can be change
  275 +abstract class GetState<T> extends GetxController {
  276 + GetState(T initialValue) {
  277 + _state = initialValue;
  278 + }
  279 +
  280 + // StreamController<T> _subject;
  281 +
  282 + // @override
  283 + // void onClose() {
  284 + // _subject?.close();
  285 + // }
  286 +
  287 + // Stream<T> get stream {
  288 + // if (_subject == null) {
  289 + // _subject = StreamController<T>.broadcast();
  290 + // }
  291 + // return _subject.stream;
  292 + // }
  293 +
  294 + T _state;
  295 +
  296 + T get state => _state;
  297 +
  298 + @protected
  299 + void change(T newState) {
  300 + if (newState != _state) {
  301 + _state = newState;
  302 + update();
  303 + }
  304 + }
  305 +}
1 import 'package:flutter/widgets.dart'; 1 import 'package:flutter/widgets.dart';
2 import 'package:get_instance/get_instance.dart'; 2 import 'package:get_instance/get_instance.dart';
  3 +import '../rx_flutter/rx_disposable.dart';
3 4
4 /// GetView is a great way of quickly access your Controller 5 /// GetView is a great way of quickly access your Controller
5 /// without having to call Get.find<AwesomeController>() yourself. 6 /// without having to call Get.find<AwesomeController>() yourself.
@@ -38,7 +39,8 @@ abstract class GetView<T> extends StatelessWidget { @@ -38,7 +39,8 @@ abstract class GetView<T> extends StatelessWidget {
38 Widget build(BuildContext context); 39 Widget build(BuildContext context);
39 } 40 }
40 41
41 -abstract class GetWidget<T extends GetLifeCycle> extends GetStatelessWidget { 42 +abstract class GetWidget<T extends DisposableInterface>
  43 + extends GetStatelessWidget {
42 GetWidget({Key key}) : super(key: key); 44 GetWidget({Key key}) : super(key: key);
43 45
44 final Set<T> _value = <T>{}; 46 final Set<T> _value = <T>{};
@@ -91,18 +93,23 @@ class GetStatelessElement extends ComponentElement { @@ -91,18 +93,23 @@ class GetStatelessElement extends ComponentElement {
91 93
92 @override 94 @override
93 void mount(Element parent, dynamic newSlot) { 95 void mount(Element parent, dynamic newSlot) {
94 - widget.controller?.onStart(); 96 + if (widget?.controller?.initialized != null &&
  97 + !widget.controller.initialized) {
  98 + widget?.controller?.onStart();
  99 + }
  100 +
95 super.mount(parent, newSlot); 101 super.mount(parent, newSlot);
96 } 102 }
97 103
98 @override 104 @override
99 void unmount() { 105 void unmount() {
100 - widget.controller?.onClose(); 106 + widget?.controller?.onClose();
101 super.unmount(); 107 super.unmount();
102 } 108 }
103 } 109 }
104 110
105 -abstract class GetStatelessWidget<T extends GetLifeCycle> extends Widget { 111 +abstract class GetStatelessWidget<T extends DisposableInterface>
  112 + extends Widget {
106 const GetStatelessWidget({Key key}) : super(key: key); 113 const GetStatelessWidget({Key key}) : super(key: key);
107 @override 114 @override
108 GetStatelessElement createElement() => GetStatelessElement(this); 115 GetStatelessElement createElement() => GetStatelessElement(this);
1 name: get_state_manager 1 name: get_state_manager
2 description: The most powerful, easier and flexible StateManager to Flutter and GetX™ framework. 2 description: The most powerful, easier and flexible StateManager to Flutter and GetX™ framework.
3 -version: 3.10.2 3 +version: 3.12.0
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
  1 +## [3.12.3]
  2 +* Added compatibility with last GetX
  3 +
  4 +## [3.12.0]
  5 +* Bump to Get 3.12.0
  6 +
1 ## [3.11.0] 7 ## [3.11.0]
2 - Compatibility with get 3.11.0 8 - Compatibility with get 3.11.0
3 9
@@ -23,10 +23,11 @@ environment: @@ -23,10 +23,11 @@ environment:
23 dependencies: 23 dependencies:
24 flutter: 24 flutter:
25 sdk: flutter 25 sdk: flutter
26 - get_test:  
27 - path: ../  
28 get: 26 get:
29 - path: ../../../getx 27 + git:
  28 + url: git://github.com/jonataslaw/getx.git
  29 + path: getx
  30 + ref: master
30 31
31 32
32 # The following adds the Cupertino Icons font to your application. 33 # The following adds the Cupertino Icons font to your application.
@@ -3,7 +3,9 @@ import 'package:flutter/scheduler.dart'; @@ -3,7 +3,9 @@ import 'package:flutter/scheduler.dart';
3 import 'package:flutter_test/flutter_test.dart'; 3 import 'package:flutter_test/flutter_test.dart';
4 import 'package:get_navigation/get_navigation.dart'; 4 import 'package:get_navigation/get_navigation.dart';
5 import 'package:get_state_manager/get_state_manager.dart'; 5 import 'package:get_state_manager/get_state_manager.dart';
6 -import 'package:image_test_utils/image_test_utils.dart'; 6 +import 'package:meta/meta.dart';
  7 +import 'utils/image_test.dart'
  8 + if (dart.library.io) 'utils/image_test_utils.dart';
7 9
8 class _Wrapper extends StatelessWidget { 10 class _Wrapper extends StatelessWidget {
9 final Widget child; 11 final Widget child;
@@ -26,6 +28,7 @@ class _Wrapper extends StatelessWidget { @@ -26,6 +28,7 @@ class _Wrapper extends StatelessWidget {
26 } 28 }
27 } 29 }
28 30
  31 +@isTest
29 void testController<T>( 32 void testController<T>(
30 String description, 33 String description,
31 void Function(T) callback, { 34 void Function(T) callback, {
@@ -44,6 +47,7 @@ void testController<T>( @@ -44,6 +47,7 @@ void testController<T>(
44 }); 47 });
45 } 48 }
46 49
  50 +@isTest
47 Future<T> testGetX<T extends DisposableInterface>( 51 Future<T> testGetX<T extends DisposableInterface>(
48 String description, { 52 String description, {
49 @required GetX<T> widget, 53 @required GetX<T> widget,
@@ -60,6 +64,7 @@ Future<T> testGetX<T extends DisposableInterface>( @@ -60,6 +64,7 @@ Future<T> testGetX<T extends DisposableInterface>(
60 return controller; 64 return controller;
61 } 65 }
62 66
  67 +@isTest
63 Future<T> testGetBuilder<T extends GetxController>( 68 Future<T> testGetBuilder<T extends GetxController>(
64 String description, { 69 String description, {
65 @required GetBuilder<T> widget, 70 @required GetBuilder<T> widget,
@@ -76,6 +81,7 @@ Future<T> testGetBuilder<T extends GetxController>( @@ -76,6 +81,7 @@ Future<T> testGetBuilder<T extends GetxController>(
76 return controller; 81 return controller;
77 } 82 }
78 83
  84 +@isTest
79 Future<T> testObx<T extends GetxController>( 85 Future<T> testObx<T extends GetxController>(
80 String description, { 86 String description, {
81 @required T controller, 87 @required T controller,
@@ -91,6 +97,7 @@ Future<T> testObx<T extends GetxController>( @@ -91,6 +97,7 @@ Future<T> testObx<T extends GetxController>(
91 return controller; 97 return controller;
92 } 98 }
93 99
  100 +@isTest
94 void getTest( 101 void getTest(
95 String description, { 102 String description, {
96 @required WidgetTesterCallback widgetTest, 103 @required WidgetTesterCallback widgetTest,
  1 +R provideMockedNetworkImages<R>(R body()) {
  2 + return body();
  3 +}
  1 +import 'dart:async';
  2 +import 'dart:io';
  3 +import 'package:mockito/mockito.dart';
  4 +
  5 +/// Copyright 2018 Iiro Krankka
  6 +/// Redistribution and use in source and binary forms, with or without
  7 +/// modification, are permitted provided that the following conditions are met:
  8 +/// 1. Redistributions of source code must retain the above copyright notice,
  9 +/// this list of conditions and the following disclaimer.
  10 +/// 2. Redistributions in binary form must reproduce the above copyright
  11 +/// notice, this list of conditions and the following disclaimer in the
  12 +/// documentation and/or other materials provided with the distribution.
  13 +/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  14 +/// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  15 +/// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16 +/// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  17 +/// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18 +/// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19 +/// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  20 +/// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21 +/// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22 +/// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  23 +/// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24 +
  25 +/// Runs [body] in a fresh [Zone] that provides mocked responses for
  26 +/// [Image.network] widgets.
  27 +///
  28 +/// Behind the scenes, this creates a mocked HTTP client that responds
  29 +/// with mocked
  30 +/// image data to all HTTP GET requests.
  31 +///
  32 +/// This is a workaround needed for widget tests that use network images.
  33 +/// Without
  34 +/// the mocked HTTP client, any widget tests that pump a widget tree containing
  35 +/// [Image.network] widgets will crash.
  36 +///
  37 +/// By default, the mocked HTTP client will respond with [_transparentImage]. If
  38 +/// provided, it will use [imageBytes] instead.
  39 +///
  40 +/// Example usage in a test case:
  41 +///
  42 +/// ```
  43 +/// void main() {
  44 +/// testWidgets('should not crash', (WidgetTester tester) async {
  45 +/// provideMockedNetworkImages(() async {
  46 +/// await tester.pumpWidget(
  47 +/// MaterialApp(
  48 +/// home: Image.network('https://example.com/image.png'),
  49 +/// ),
  50 +/// );
  51 +/// });
  52 +/// });
  53 +/// }
  54 +/// ```
  55 +///
  56 +/// Note that you'll want to add this package to the dev_dependencies instead of
  57 +/// the regular dependencies block on your pubspec.yaml.
  58 +///
  59 +/// For more context about [Image.network] widgets failing in widget tests, see
  60 +/// these issues:
  61 +///
  62 +/// * https://github.com/flutter/flutter/issues/13433
  63 +/// * https://github.com/flutter/flutter_markdown/pull/17
  64 +///
  65 +/// The underlying code is taken from the Flutter repo:
  66 +/// https://github.com/flutter/flutter/blob/master/dev/manual_tests/test/mock_image_http.dart
  67 +R provideMockedNetworkImages<R>(R body(),
  68 + {List<int> imageBytes = _transparentImage}) {
  69 + return HttpOverrides.runZoned(
  70 + body,
  71 + createHttpClient: (_) => _createMockImageHttpClient(_, imageBytes),
  72 + );
  73 +}
  74 +
  75 +class MockHttpClient extends Mock implements HttpClient {}
  76 +
  77 +class MockHttpClientRequest extends Mock implements HttpClientRequest {}
  78 +
  79 +class MockHttpClientResponse extends Mock implements HttpClientResponse {}
  80 +
  81 +class MockHttpHeaders extends Mock implements HttpHeaders {}
  82 +
  83 +// Returns a mock HTTP client that responds with an image to all requests.
  84 +MockHttpClient _createMockImageHttpClient(
  85 + SecurityContext _, List<int> imageBytes) {
  86 + final client = MockHttpClient();
  87 + final request = MockHttpClientRequest();
  88 + final response = MockHttpClientResponse();
  89 + final headers = MockHttpHeaders();
  90 +
  91 + when(client.getUrl(any))
  92 + .thenAnswer((_) => Future<HttpClientRequest>.value(request));
  93 + when(request.headers).thenReturn(headers);
  94 + when(request.close())
  95 + .thenAnswer((_) => Future<HttpClientResponse>.value(response));
  96 + when(response.contentLength).thenReturn(_transparentImage.length);
  97 + when(response.statusCode).thenReturn(HttpStatus.ok);
  98 + when(response.listen(any)).thenAnswer((invocation) {
  99 + final onData =
  100 + invocation.positionalArguments[0] as void Function(List<int>);
  101 + final onDone = invocation.namedArguments[#onDone] as void Function();
  102 + final onError = invocation.namedArguments[#onError] as void Function(Object,
  103 + [StackTrace]);
  104 + final cancelOnError = invocation.namedArguments[#cancelOnError] as bool;
  105 +
  106 + return Stream<List<int>>.fromIterable(<List<int>>[imageBytes]).listen(
  107 + onData,
  108 + onDone: onDone,
  109 + onError: onError,
  110 + cancelOnError: cancelOnError);
  111 + });
  112 +
  113 + return client;
  114 +}
  115 +
  116 +const List<int> _transparentImage = <int>[
  117 + 0x89,
  118 + 0x50,
  119 + 0x4E,
  120 + 0x47,
  121 + 0x0D,
  122 + 0x0A,
  123 + 0x1A,
  124 + 0x0A,
  125 + 0x00,
  126 + 0x00,
  127 + 0x00,
  128 + 0x0D,
  129 + 0x49,
  130 + 0x48,
  131 + 0x44,
  132 + 0x52,
  133 + 0x00,
  134 + 0x00,
  135 + 0x00,
  136 + 0x01,
  137 + 0x00,
  138 + 0x00,
  139 + 0x00,
  140 + 0x01,
  141 + 0x08,
  142 + 0x06,
  143 + 0x00,
  144 + 0x00,
  145 + 0x00,
  146 + 0x1F,
  147 + 0x15,
  148 + 0xC4,
  149 + 0x89,
  150 + 0x00,
  151 + 0x00,
  152 + 0x00,
  153 + 0x0A,
  154 + 0x49,
  155 + 0x44,
  156 + 0x41,
  157 + 0x54,
  158 + 0x78,
  159 + 0x9C,
  160 + 0x63,
  161 + 0x00,
  162 + 0x01,
  163 + 0x00,
  164 + 0x00,
  165 + 0x05,
  166 + 0x00,
  167 + 0x01,
  168 + 0x0D,
  169 + 0x0A,
  170 + 0x2D,
  171 + 0xB4,
  172 + 0x00,
  173 + 0x00,
  174 + 0x00,
  175 + 0x00,
  176 + 0x49,
  177 + 0x45,
  178 + 0x4E,
  179 + 0x44,
  180 + 0xAE,
  181 +];
1 name: get_test 1 name: get_test
2 description: A package that facilitates the creation of tests for applications built with GetX 2 description: A package that facilitates the creation of tests for applications built with GetX
3 -version: 3.11.0 3 +version: 3.12.3
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
@@ -10,7 +10,7 @@ environment: @@ -10,7 +10,7 @@ environment:
10 dependencies: 10 dependencies:
11 flutter: 11 flutter:
12 sdk: flutter 12 sdk: flutter
13 - mockito: ">=3.0.0 <4.0.0" 13 + mockito: ">=3.0.0 <5.0.0"
14 get_navigation: 14 get_navigation:
15 git: 15 git:
16 url: git://github.com/jonataslaw/getx.git 16 url: git://github.com/jonataslaw/getx.git
@@ -21,7 +21,7 @@ dependencies: @@ -21,7 +21,7 @@ dependencies:
21 url: git://github.com/jonataslaw/getx.git 21 url: git://github.com/jonataslaw/getx.git
22 path: packages/get_state_manager 22 path: packages/get_state_manager
23 ref: master 23 ref: master
24 - image_test_utils: ">=1.0.0 <2.0.0" 24 + meta: ">=1.1.0 <2.0.0"
25 flutter_test: 25 flutter_test:
26 sdk: flutter 26 sdk: flutter
27 27
  1 +## [3.12.0]
  2 +* Bump to Get 3.12.0
  3 +* Improve capitalizeFirst method
  4 +
  5 +
1 ## [3.10.2] 6 ## [3.10.2]
2 7
3 - Initial release 8 - Initial release
1 name: get_utils 1 name: get_utils
2 description: A set of tools that allows you to access high-level APIs and obtain validation tools for Flutter and GetX™ framework. 2 description: A set of tools that allows you to access high-level APIs and obtain validation tools for Flutter and GetX™ framework.
3 -version: 3.10.2 3 +version: 3.12.0
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
1 -# Generated by pub  
2 -# See https://dart.dev/tools/pub/glossary#lockfile  
3 -packages:  
4 - async:  
5 - dependency: transitive  
6 - description:  
7 - name: async  
8 - url: "https://pub.dartlang.org"  
9 - source: hosted  
10 - version: "2.4.2"  
11 - boolean_selector:  
12 - dependency: transitive  
13 - description:  
14 - name: boolean_selector  
15 - url: "https://pub.dartlang.org"  
16 - source: hosted  
17 - version: "2.0.0"  
18 - characters:  
19 - dependency: transitive  
20 - description:  
21 - name: characters  
22 - url: "https://pub.dartlang.org"  
23 - source: hosted  
24 - version: "1.0.0"  
25 - charcode:  
26 - dependency: transitive  
27 - description:  
28 - name: charcode  
29 - url: "https://pub.dartlang.org"  
30 - source: hosted  
31 - version: "1.1.3"  
32 - clock:  
33 - dependency: transitive  
34 - description:  
35 - name: clock  
36 - url: "https://pub.dartlang.org"  
37 - source: hosted  
38 - version: "1.0.1"  
39 - collection:  
40 - dependency: transitive  
41 - description:  
42 - name: collection  
43 - url: "https://pub.dartlang.org"  
44 - source: hosted  
45 - version: "1.14.13"  
46 - effective_dart:  
47 - dependency: "direct dev"  
48 - description:  
49 - name: effective_dart  
50 - url: "https://pub.dartlang.org"  
51 - source: hosted  
52 - version: "1.2.4"  
53 - fake_async:  
54 - dependency: transitive  
55 - description:  
56 - name: fake_async  
57 - url: "https://pub.dartlang.org"  
58 - source: hosted  
59 - version: "1.1.0"  
60 - flutter:  
61 - dependency: "direct main"  
62 - description: flutter  
63 - source: sdk  
64 - version: "0.0.0"  
65 - flutter_test:  
66 - dependency: "direct dev"  
67 - description: flutter  
68 - source: sdk  
69 - version: "0.0.0"  
70 - matcher:  
71 - dependency: transitive  
72 - description:  
73 - name: matcher  
74 - url: "https://pub.dartlang.org"  
75 - source: hosted  
76 - version: "0.12.8"  
77 - meta:  
78 - dependency: transitive  
79 - description:  
80 - name: meta  
81 - url: "https://pub.dartlang.org"  
82 - source: hosted  
83 - version: "1.1.8"  
84 - path:  
85 - dependency: transitive  
86 - description:  
87 - name: path  
88 - url: "https://pub.dartlang.org"  
89 - source: hosted  
90 - version: "1.7.0"  
91 - sky_engine:  
92 - dependency: transitive  
93 - description: flutter  
94 - source: sdk  
95 - version: "0.0.99"  
96 - source_span:  
97 - dependency: transitive  
98 - description:  
99 - name: source_span  
100 - url: "https://pub.dartlang.org"  
101 - source: hosted  
102 - version: "1.7.0"  
103 - stack_trace:  
104 - dependency: transitive  
105 - description:  
106 - name: stack_trace  
107 - url: "https://pub.dartlang.org"  
108 - source: hosted  
109 - version: "1.9.5"  
110 - stream_channel:  
111 - dependency: transitive  
112 - description:  
113 - name: stream_channel  
114 - url: "https://pub.dartlang.org"  
115 - source: hosted  
116 - version: "2.0.0"  
117 - string_scanner:  
118 - dependency: transitive  
119 - description:  
120 - name: string_scanner  
121 - url: "https://pub.dartlang.org"  
122 - source: hosted  
123 - version: "1.0.5"  
124 - term_glyph:  
125 - dependency: transitive  
126 - description:  
127 - name: term_glyph  
128 - url: "https://pub.dartlang.org"  
129 - source: hosted  
130 - version: "1.1.0"  
131 - test_api:  
132 - dependency: transitive  
133 - description:  
134 - name: test_api  
135 - url: "https://pub.dartlang.org"  
136 - source: hosted  
137 - version: "0.2.17"  
138 - typed_data:  
139 - dependency: transitive  
140 - description:  
141 - name: typed_data  
142 - url: "https://pub.dartlang.org"  
143 - source: hosted  
144 - version: "1.2.0"  
145 - vector_math:  
146 - dependency: transitive  
147 - description:  
148 - name: vector_math  
149 - url: "https://pub.dartlang.org"  
150 - source: hosted  
151 - version: "2.0.8"  
152 -sdks:  
153 - dart: ">=2.9.0-14.0.dev <3.0.0"