Jonny Borges

release ready

Showing 41 changed files with 224 additions and 284 deletions
@@ -262,7 +262,7 @@ class GetConnect extends GetConnectInterface { @@ -262,7 +262,7 @@ class GetConnect extends GetConnectInterface {
262 }) { 262 }) {
263 _checkIfDisposed(isHttp: false); 263 _checkIfDisposed(isHttp: false);
264 264
265 - final _socket = GetSocket(_concatUrl(url), ping: ping); 265 + final _socket = GetSocket(_concatUrl(url)!, ping: ping);
266 sockets.add(_socket); 266 sockets.add(_socket);
267 return _socket; 267 return _socket;
268 } 268 }
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:convert'; 2 import 'dart:convert';
3 -import 'package:flutter/foundation.dart';  
4 3
5 import '../src/certificates/certificates.dart'; 4 import '../src/certificates/certificates.dart';
6 import '../src/exceptions/exceptions.dart'; 5 import '../src/exceptions/exceptions.dart';
@@ -38,6 +38,7 @@ class HttpRequestImpl implements HttpRequestBase { @@ -38,6 +38,7 @@ class HttpRequestImpl implements HttpRequestBase {
38 ..responseType = 'blob' 38 ..responseType = 'blob'
39 ..withCredentials = withCredentials; 39 ..withCredentials = withCredentials;
40 request.headers.forEach(xhr.setRequestHeader); 40 request.headers.forEach(xhr.setRequestHeader);
  41 + request.contentLength ?? -1;
41 42
42 var completer = Completer<Response<T>>(); 43 var completer = Completer<Response<T>>();
43 xhr.onLoad.first.then((_) { 44 xhr.onLoad.first.then((_) {
@@ -32,7 +32,7 @@ class HttpRequestImpl extends HttpRequestBase { @@ -32,7 +32,7 @@ class HttpRequestImpl extends HttpRequestBase {
32 32
33 @override 33 @override
34 Future<Response<T>> send<T>(Request<T> request) async { 34 Future<Response<T>> send<T>(Request<T> request) async {
35 - Stream<List<int>?> stream = request.bodyBytes.asBroadcastStream(); 35 + var stream = request.bodyBytes.asBroadcastStream();
36 //var stream = BodyBytesStream.fromBytes(requestBody ?? const []); 36 //var stream = BodyBytesStream.fromBytes(requestBody ?? const []);
37 37
38 try { 38 try {
@@ -16,7 +16,7 @@ class MockClient extends HttpRequestBase { @@ -16,7 +16,7 @@ class MockClient extends HttpRequestBase {
16 @override 16 @override
17 Future<Response<T>> send<T>(Request<T> request) async { 17 Future<Response<T>> send<T>(Request<T> request) async {
18 var requestBody = await request.bodyBytes.toBytes(); 18 var requestBody = await request.bodyBytes.toBytes();
19 - var bodyBytes = BodyBytesStream.fromBytes(requestBody ?? const []); 19 + var bodyBytes = BodyBytesStream.fromBytes(requestBody);
20 20
21 var response = await _handler(request); 21 var response = await _handler(request);
22 22
@@ -57,9 +57,7 @@ class FormData { @@ -57,9 +57,7 @@ class FormData {
57 String _fileHeader(MapEntry<String, MultipartFile> file) { 57 String _fileHeader(MapEntry<String, MultipartFile> file) {
58 var header = 58 var header =
59 'content-disposition: form-data; name="${browserEncode(file.key)}"'; 59 'content-disposition: form-data; name="${browserEncode(file.key)}"';
60 - if (file.value.filename != null) {  
61 - header = '$header; filename="${browserEncode(file.value.filename)}"';  
62 - } 60 + header = '$header; filename="${browserEncode(file.value.filename)}"';
63 header = '$header\r\n' 61 header = '$header\r\n'
64 'content-type: ${file.value.contentType}'; 62 'content-type: ${file.value.contentType}';
65 return '$header\r\n\r\n'; 63 return '$header\r\n\r\n';
1 -import 'package:flutter/foundation.dart';  
2 -  
3 import '../http/stub/file_decoder_stub.dart' 1 import '../http/stub/file_decoder_stub.dart'
4 if (dart.library.html) '../http/html/file_decoder_html.dart' 2 if (dart.library.html) '../http/html/file_decoder_html.dart'
5 if (dart.library.io) '../http/io/file_decoder_io.dart'; 3 if (dart.library.io) '../http/io/file_decoder_io.dart';
@@ -3,7 +3,7 @@ import 'src/sockets_stub.dart' @@ -3,7 +3,7 @@ import 'src/sockets_stub.dart'
3 if (dart.library.io) 'src/sockets_io.dart'; 3 if (dart.library.io) 'src/sockets_io.dart';
4 4
5 class GetSocket extends BaseWebSocket { 5 class GetSocket extends BaseWebSocket {
6 - GetSocket(String? url, 6 + GetSocket(String url,
7 {Duration ping = const Duration(seconds: 5), bool allowSelfSigned = true}) 7 {Duration ping = const Duration(seconds: 5), bool allowSelfSigned = true})
8 : super(url, ping: ping, allowSelfSigned: allowSelfSigned); 8 : super(url, ping: ping, allowSelfSigned: allowSelfSigned);
9 } 9 }
@@ -54,7 +54,8 @@ class BaseWebSocket { @@ -54,7 +54,8 @@ class BaseWebSocket {
54 return; 54 return;
55 } on SocketException catch (e) { 55 } on SocketException catch (e) {
56 connectionStatus = ConnectionStatus.closed; 56 connectionStatus = ConnectionStatus.closed;
57 - socketNotifier!.notifyError(Close(e.osError!.message, e.osError!.errorCode)); 57 + socketNotifier!
  58 + .notifyError(Close(e.osError!.message, e.osError!.errorCode));
58 return; 59 return;
59 } 60 }
60 } 61 }
1 import './socket_notifier.dart'; 1 import './socket_notifier.dart';
2 2
3 class BaseWebSocket { 3 class BaseWebSocket {
4 - String? url; 4 + String url;
5 Duration ping; 5 Duration ping;
6 bool allowSelfSigned; 6 bool allowSelfSigned;
7 BaseWebSocket( 7 BaseWebSocket(
@@ -109,7 +109,8 @@ extension Inst on GetInterface { @@ -109,7 +109,8 @@ extension Inst on GetInterface {
109 109
110 /// Checks if a Class Instance<[S]> (or [tag]) is registered in memory. 110 /// Checks if a Class Instance<[S]> (or [tag]) is registered in memory.
111 /// - [tag] optional, if you use a [tag] to register the Instance. 111 /// - [tag] optional, if you use a [tag] to register the Instance.
112 - bool isRegistered<S>({String? tag}) => GetInstance().isRegistered<S>(tag: tag); 112 + bool isRegistered<S>({String? tag}) =>
  113 + GetInstance().isRegistered<S>(tag: tag);
113 114
114 /// Checks if an Instance<[S]> (or [tag]) returned from a factory builder 115 /// Checks if an Instance<[S]> (or [tag]) returned from a factory builder
115 /// [Get.lazyPut()], is registered in memory. 116 /// [Get.lazyPut()], is registered in memory.
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:collection'; 2 import 'dart:collection';
3 3
4 -import 'package:flutter/foundation.dart';  
5 -  
6 import '../../get_core/get_core.dart'; 4 import '../../get_core/get_core.dart';
7 5
8 import 'lifecycle.dart'; 6 import 'lifecycle.dart';
@@ -177,7 +175,6 @@ class GetInstance { @@ -177,7 +175,6 @@ class GetInstance {
177 required InstanceBuilderCallback<S> builder, 175 required InstanceBuilderCallback<S> builder,
178 bool fenix = false, 176 bool fenix = false,
179 }) { 177 }) {
180 - assert(builder != null);  
181 final key = _getKey(S, name); 178 final key = _getKey(S, name);
182 _singl.putIfAbsent( 179 _singl.putIfAbsent(
183 key, 180 key,
@@ -209,9 +206,7 @@ class GetInstance { @@ -209,9 +206,7 @@ class GetInstance {
209 for (final onClose in _routesByCreate[routeName]!) { 206 for (final onClose in _routesByCreate[routeName]!) {
210 // assure the [DisposableInterface] instance holding a reference 207 // assure the [DisposableInterface] instance holding a reference
211 // to [onClose()] wasn't disposed. 208 // to [onClose()] wasn't disposed.
212 - if (onClose != null) {  
213 - onClose();  
214 - } 209 + onClose();
215 } 210 }
216 _routesByCreate[routeName]!.clear(); 211 _routesByCreate[routeName]!.clear();
217 _routesByCreate.remove(routeName); 212 _routesByCreate.remove(routeName);
@@ -222,7 +217,7 @@ class GetInstance { @@ -222,7 +217,7 @@ class GetInstance {
222 } 217 }
223 218
224 for (final element in keysToRemove) { 219 for (final element in keysToRemove) {
225 - _routesKey?.remove(element); 220 + _routesKey.remove(element);
226 } 221 }
227 keysToRemove.clear(); 222 keysToRemove.clear();
228 } 223 }
@@ -286,15 +281,13 @@ class GetInstance { @@ -286,15 +281,13 @@ class GetInstance {
286 final key = _getKey(S, tag); 281 final key = _getKey(S, tag);
287 final i = _singl[key]!.getDependency() as S?; 282 final i = _singl[key]!.getDependency() as S?;
288 if (i is GetLifeCycleBase) { 283 if (i is GetLifeCycleBase) {
289 - if (i.onStart != null) {  
290 - i.onStart();  
291 - if (tag == null) {  
292 - Get.log('Instance "$S" has been initialized');  
293 - } else {  
294 - Get.log('Instance "$S" with tag "$tag" has been initialized');  
295 - } 284 + i.onStart();
  285 + if (tag == null) {
  286 + Get.log('Instance "$S" has been initialized');
  287 + } else {
  288 + Get.log('Instance "$S" with tag "$tag" has been initialized');
296 } 289 }
297 - if (!_singl[key]!.isSingleton! && i.onDelete != null) { 290 + if (!_singl[key]!.isSingleton!) {
298 _routesByCreate[Get.reference] ??= HashSet<Function>(); 291 _routesByCreate[Get.reference] ??= HashSet<Function>();
299 _routesByCreate[Get.reference]!.add(i.onDelete as Function); 292 _routesByCreate[Get.reference]!.add(i.onDelete as Function);
300 } 293 }
@@ -398,7 +391,7 @@ class GetInstance { @@ -398,7 +391,7 @@ class GetInstance {
398 return false; 391 return false;
399 } 392 }
400 393
401 - if (i is GetLifeCycleBase && i.onDelete != null) { 394 + if (i is GetLifeCycleBase) {
402 i.onDelete(); 395 i.onDelete();
403 Get.log('"$newKey" onDelete() called'); 396 Get.log('"$newKey" onDelete() called');
404 } 397 }
@@ -18,10 +18,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -18,10 +18,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
18 RouteSettings? settings, 18 RouteSettings? settings,
19 this.enterBottomSheetDuration = const Duration(milliseconds: 250), 19 this.enterBottomSheetDuration = const Duration(milliseconds: 250),
20 this.exitBottomSheetDuration = const Duration(milliseconds: 200), 20 this.exitBottomSheetDuration = const Duration(milliseconds: 200),
21 - }) : assert(isScrollControlled != null),  
22 - name = "BOTTOMSHEET: ${builder.hashCode}",  
23 - assert(isDismissible != null),  
24 - assert(enableDrag != null), 21 + }) : name = "BOTTOMSHEET: ${builder.hashCode}",
25 super(settings: settings); 22 super(settings: settings);
26 final bool? isPersistent; 23 final bool? isPersistent;
27 final WidgetBuilder? builder; 24 final WidgetBuilder? builder;
@@ -80,10 +77,10 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -80,10 +77,10 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
80 child: _GetModalBottomSheet<T>( 77 child: _GetModalBottomSheet<T>(
81 route: this, 78 route: this,
82 backgroundColor: backgroundColor ?? 79 backgroundColor: backgroundColor ??
83 - sheetTheme?.modalBackgroundColor ??  
84 - sheetTheme?.backgroundColor, 80 + sheetTheme.modalBackgroundColor ??
  81 + sheetTheme.backgroundColor,
85 elevation: 82 elevation:
86 - elevation ?? sheetTheme?.modalElevation ?? sheetTheme?.elevation, 83 + elevation ?? sheetTheme.modalElevation ?? sheetTheme.elevation,
87 shape: shape, 84 shape: shape,
88 clipBehavior: clipBehavior, 85 clipBehavior: clipBehavior,
89 isScrollControlled: isScrollControlled, 86 isScrollControlled: isScrollControlled,
@@ -107,9 +104,7 @@ class _GetModalBottomSheet<T> extends StatefulWidget { @@ -107,9 +104,7 @@ class _GetModalBottomSheet<T> extends StatefulWidget {
107 this.isScrollControlled = false, 104 this.isScrollControlled = false,
108 this.enableDrag = true, 105 this.enableDrag = true,
109 this.isPersistent = false, 106 this.isPersistent = false,
110 - }) : assert(isScrollControlled != null),  
111 - assert(enableDrag != null),  
112 - super(key: key); 107 + }) : super(key: key);
113 final bool isPersistent; 108 final bool isPersistent;
114 final GetModalBottomSheetRoute<T>? route; 109 final GetModalBottomSheetRoute<T>? route;
115 final bool isScrollControlled; 110 final bool isScrollControlled;
@@ -208,9 +203,7 @@ class _GetPerModalBottomSheet<T> extends StatefulWidget { @@ -208,9 +203,7 @@ class _GetPerModalBottomSheet<T> extends StatefulWidget {
208 this.clipBehavior, 203 this.clipBehavior,
209 this.isScrollControlled = false, 204 this.isScrollControlled = false,
210 this.enableDrag = true, 205 this.enableDrag = true,
211 - }) : assert(isScrollControlled != null),  
212 - assert(enableDrag != null),  
213 - super(key: key); 206 + }) : super(key: key);
214 final bool? isPersistent; 207 final bool? isPersistent;
215 final GetModalBottomSheetRoute<T>? route; 208 final GetModalBottomSheetRoute<T>? route;
216 final bool isScrollControlled; 209 final bool isScrollControlled;
@@ -11,8 +11,7 @@ class GetDialogRoute<T> extends PopupRoute<T> { @@ -11,8 +11,7 @@ class GetDialogRoute<T> extends PopupRoute<T> {
11 Duration transitionDuration = const Duration(milliseconds: 200), 11 Duration transitionDuration = const Duration(milliseconds: 200),
12 RouteTransitionsBuilder? transitionBuilder, 12 RouteTransitionsBuilder? transitionBuilder,
13 RouteSettings? settings, 13 RouteSettings? settings,
14 - }) : assert(barrierDismissible != null),  
15 - widget = pageBuilder, 14 + }) : widget = pageBuilder,
16 name = "DIALOG: ${pageBuilder.hashCode}", 15 name = "DIALOG: ${pageBuilder.hashCode}",
17 _barrierDismissible = barrierDismissible, 16 _barrierDismissible = barrierDismissible,
18 _barrierLabel = barrierLabel, 17 _barrierLabel = barrierLabel,
@@ -145,17 +145,15 @@ extension ExtensionSnackbar on GetInterface { @@ -145,17 +145,15 @@ extension ExtensionSnackbar on GetInterface {
145 }) async { 145 }) async {
146 final getBar = GetBar( 146 final getBar = GetBar(
147 snackbarStatus: snackbarStatus, 147 snackbarStatus: snackbarStatus,
148 - titleText: (title == null)  
149 - ? null  
150 - : titleText ??  
151 - Text(  
152 - title,  
153 - style: TextStyle(  
154 - color: colorText ?? iconColor ?? Colors.black,  
155 - fontWeight: FontWeight.w800,  
156 - fontSize: 16,  
157 - ),  
158 - ), 148 + titleText: titleText ??
  149 + Text(
  150 + title,
  151 + style: TextStyle(
  152 + color: colorText ?? iconColor ?? Colors.black,
  153 + fontWeight: FontWeight.w800,
  154 + fontSize: 16,
  155 + ),
  156 + ),
159 messageText: messageText ?? 157 messageText: messageText ??
160 Text( 158 Text(
161 message, 159 message,
@@ -224,10 +222,6 @@ extension ExtensionDialog on GetInterface { @@ -224,10 +222,6 @@ extension ExtensionDialog on GetInterface {
224 String? name, 222 String? name,
225 RouteSettings? routeSettings, 223 RouteSettings? routeSettings,
226 }) { 224 }) {
227 - assert(widget != null);  
228 - assert(barrierDismissible != null);  
229 - assert(useSafeArea != null);  
230 - assert(useRootNavigator != null);  
231 assert(debugCheckHasMaterialLocalizations(context!)); 225 assert(debugCheckHasMaterialLocalizations(context!));
232 226
233 // final theme = Theme.of(context, shadowThemeOnly: true); 227 // final theme = Theme.of(context, shadowThemeOnly: true);
@@ -236,9 +230,7 @@ extension ExtensionDialog on GetInterface { @@ -236,9 +230,7 @@ extension ExtensionDialog on GetInterface {
236 pageBuilder: (buildContext, animation, secondaryAnimation) { 230 pageBuilder: (buildContext, animation, secondaryAnimation) {
237 final pageChild = widget; 231 final pageChild = widget;
238 Widget dialog = Builder(builder: (context) { 232 Widget dialog = Builder(builder: (context) {
239 - return theme != null  
240 - ? Theme(data: theme, child: pageChild)  
241 - : pageChild; 233 + return Theme(data: theme, child: pageChild);
242 }); 234 });
243 if (useSafeArea) { 235 if (useSafeArea) {
244 dialog = SafeArea(child: dialog); 236 dialog = SafeArea(child: dialog);
@@ -275,8 +267,6 @@ extension ExtensionDialog on GetInterface { @@ -275,8 +267,6 @@ extension ExtensionDialog on GetInterface {
275 bool useRootNavigator = true, 267 bool useRootNavigator = true,
276 RouteSettings? routeSettings, 268 RouteSettings? routeSettings,
277 }) { 269 }) {
278 - assert(pageBuilder != null);  
279 - assert(useRootNavigator != null);  
280 assert(!barrierDismissible || barrierLabel != null); 270 assert(!barrierDismissible || barrierLabel != null);
281 return Navigator.of(overlayContext!, rootNavigator: useRootNavigator) 271 return Navigator.of(overlayContext!, rootNavigator: useRootNavigator)
282 .push<T>(GetDialogRoute<T>( 272 .push<T>(GetDialogRoute<T>(
@@ -383,7 +373,7 @@ extension ExtensionDialog on GetInterface { @@ -383,7 +373,7 @@ extension ExtensionDialog on GetInterface {
383 mainAxisSize: MainAxisSize.min, 373 mainAxisSize: MainAxisSize.min,
384 children: [ 374 children: [
385 content ?? 375 content ??
386 - Text(middleText ?? "", 376 + Text(middleText,
387 textAlign: TextAlign.center, style: middleTextStyle), 377 textAlign: TextAlign.center, style: middleTextStyle),
388 SizedBox(height: 16), 378 SizedBox(height: 16),
389 ButtonTheme( 379 ButtonTheme(
@@ -437,13 +427,6 @@ extension ExtensionBottomSheet on GetInterface { @@ -437,13 +427,6 @@ extension ExtensionBottomSheet on GetInterface {
437 Duration? enterBottomSheetDuration, 427 Duration? enterBottomSheetDuration,
438 Duration? exitBottomSheetDuration, 428 Duration? exitBottomSheetDuration,
439 }) { 429 }) {
440 - assert(bottomsheet != null);  
441 - assert(persistent != null);  
442 - assert(isScrollControlled != null);  
443 - assert(useRootNavigator != null);  
444 - assert(isDismissible != null);  
445 - assert(enableDrag != null);  
446 -  
447 return Navigator.of(overlayContext!, rootNavigator: useRootNavigator) 430 return Navigator.of(overlayContext!, rootNavigator: useRootNavigator)
448 .push(GetModalBottomSheetRoute<T>( 431 .push(GetModalBottomSheetRoute<T>(
449 builder: (_) => bottomsheet, 432 builder: (_) => bottomsheet,
@@ -822,7 +805,7 @@ you can only use widgets and widget functions here'''; @@ -822,7 +805,7 @@ you can only use widgets and widget functions here''';
822 /// [id] is for when you are using nested navigation, 805 /// [id] is for when you are using nested navigation,
823 /// as explained in documentation 806 /// as explained in documentation
824 void close(int times, [int? id]) { 807 void close(int times, [int? id]) {
825 - if ((times == null) || (times < 1)) { 808 + if (times < 1) {
826 times = 1; 809 times = 1;
827 } 810 }
828 var count = 0; 811 var count = 0;
@@ -874,7 +857,7 @@ you can only use widgets and widget functions here'''; @@ -874,7 +857,7 @@ you can only use widgets and widget functions here''';
874 return null; 857 return null;
875 } 858 }
876 return global(id)?.currentState?.pushReplacement(GetPageRoute( 859 return global(id)?.currentState?.pushReplacement(GetPageRoute(
877 - opaque: opaque ?? true, 860 + opaque: opaque,
878 page: _resolve(page, 'off'), 861 page: _resolve(page, 'off'),
879 binding: binding, 862 binding: binding,
880 settings: RouteSettings(arguments: arguments), 863 settings: RouteSettings(arguments: arguments),
@@ -934,7 +917,7 @@ you can only use widgets and widget functions here'''; @@ -934,7 +917,7 @@ you can only use widgets and widget functions here''';
934 917
935 return global(id)?.currentState?.pushAndRemoveUntil<T>( 918 return global(id)?.currentState?.pushAndRemoveUntil<T>(
936 GetPageRoute<T>( 919 GetPageRoute<T>(
937 - opaque: opaque ?? true, 920 + opaque: opaque,
938 popGesture: popGesture ?? defaultPopGesture, 921 popGesture: popGesture ?? defaultPopGesture,
939 page: _resolve(page, 'offAll'), 922 page: _resolve(page, 'offAll'),
940 binding: binding, 923 binding: binding,
@@ -950,19 +933,15 @@ you can only use widgets and widget functions here'''; @@ -950,19 +933,15 @@ you can only use widgets and widget functions here''';
950 933
951 void addPages(List<GetPage>? getPages) { 934 void addPages(List<GetPage>? getPages) {
952 if (getPages != null) { 935 if (getPages != null) {
953 - if (routeTree == null) {  
954 - routeTree = ParseRouteTree();  
955 - } 936 + routeTree = ParseRouteTree();
956 937
957 - routeTree!.addRoutes(getPages); 938 + routeTree.addRoutes(getPages);
958 } 939 }
959 } 940 }
960 941
961 void addPage(GetPage getPage) { 942 void addPage(GetPage getPage) {
962 - if (getPage != null) {  
963 - if (routeTree == null) routeTree = ParseRouteTree();  
964 - routeTree!.addRoute(getPage);  
965 - } 943 + routeTree = ParseRouteTree();
  944 + routeTree.addRoute(getPage);
966 } 945 }
967 946
968 /// change default config of Get 947 /// change default config of Get
@@ -1100,7 +1079,7 @@ Since version 2.8 it is possible to access the properties @@ -1100,7 +1079,7 @@ Since version 2.8 it is possible to access the properties
1100 /// give access to current Overlay Context 1079 /// give access to current Overlay Context
1101 BuildContext? get overlayContext { 1080 BuildContext? get overlayContext {
1102 BuildContext? overlay; 1081 BuildContext? overlay;
1103 - key?.currentState?.overlay?.context?.visitChildElements((element) { 1082 + key?.currentState?.overlay?.context.visitChildElements((element) {
1104 overlay = element; 1083 overlay = element;
1105 }); 1084 });
1106 return overlay; 1085 return overlay;
@@ -1166,7 +1145,7 @@ Since version 2.8 it is possible to access the properties @@ -1166,7 +1145,7 @@ Since version 2.8 it is possible to access the properties
1166 (ui.window.platformBrightness == Brightness.dark); 1145 (ui.window.platformBrightness == Brightness.dark);
1167 1146
1168 /// give access to Theme.of(context).iconTheme.color 1147 /// give access to Theme.of(context).iconTheme.color
1169 - Color? get iconColor => theme?.iconTheme?.color; 1148 + Color? get iconColor => theme?.iconTheme.color;
1170 1149
1171 /// give access to FocusScope.of(context) 1150 /// give access to FocusScope.of(context)
1172 FocusNode? get focusScope => FocusManager.instance.primaryFocus; 1151 FocusNode? get focusScope => FocusManager.instance.primaryFocus;
@@ -1204,8 +1183,8 @@ Since version 2.8 it is possible to access the properties @@ -1204,8 +1183,8 @@ Since version 2.8 it is possible to access the properties
1204 1183
1205 Routing get routing => getxController.routing; 1184 Routing get routing => getxController.routing;
1206 1185
1207 - Map<String?, String> get parameters => getxController.parameters;  
1208 - set parameters(Map<String?, String> newParameters) => 1186 + Map<String, String?> get parameters => getxController.parameters;
  1187 + set parameters(Map<String, String?> newParameters) =>
1209 getxController.parameters = newParameters; 1188 getxController.parameters = newParameters;
1210 1189
1211 ParseRouteTree get routeTree => getxController.routeTree; 1190 ParseRouteTree get routeTree => getxController.routeTree;
@@ -31,11 +31,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -31,11 +31,7 @@ class GetPageRoute<T> extends PageRoute<T> {
31 this.maintainState = true, 31 this.maintainState = true,
32 bool fullscreenDialog = false, 32 bool fullscreenDialog = false,
33 this.middlewares, 33 this.middlewares,
34 - }) : assert(opaque != null),  
35 - assert(barrierDismissible != null),  
36 - assert(maintainState != null),  
37 - assert(fullscreenDialog != null),  
38 - reference = "$routeName: ${page.hashCode}", 34 + }) : reference = "$routeName: ${page.hashCode}",
39 super(settings: settings, fullscreenDialog: fullscreenDialog); 35 super(settings: settings, fullscreenDialog: fullscreenDialog);
40 36
41 @override 37 @override
@@ -416,10 +412,7 @@ class _CupertinoBackGestureDetector<T> extends StatefulWidget { @@ -416,10 +412,7 @@ class _CupertinoBackGestureDetector<T> extends StatefulWidget {
416 required this.enabledCallback, 412 required this.enabledCallback,
417 required this.onStartPopGesture, 413 required this.onStartPopGesture,
418 required this.child, 414 required this.child,
419 - }) : assert(enabledCallback != null),  
420 - assert(onStartPopGesture != null),  
421 - assert(child != null),  
422 - super(key: key); 415 + }) : super(key: key);
423 416
424 final Widget child; 417 final Widget child;
425 418
@@ -533,8 +526,7 @@ class _CupertinoBackGestureController<T> { @@ -533,8 +526,7 @@ class _CupertinoBackGestureController<T> {
533 _CupertinoBackGestureController({ 526 _CupertinoBackGestureController({
534 required this.navigator, 527 required this.navigator,
535 required this.controller, 528 required this.controller,
536 - }) : assert(navigator != null),  
537 - assert(controller != null) { 529 + }) {
538 navigator.didStartUserGesture(); 530 navigator.didStartUserGesture();
539 } 531 }
540 532
@@ -51,11 +51,7 @@ class GetPage { @@ -51,11 +51,7 @@ class GetPage {
51 this.fullscreenDialog = false, 51 this.fullscreenDialog = false,
52 this.children, 52 this.children,
53 this.middlewares, 53 this.middlewares,
54 - }) : path = _nameToRegex(name),  
55 - assert(page != null),  
56 - assert(name != null),  
57 - assert(maintainState != null),  
58 - assert(fullscreenDialog != null); 54 + }) : path = _nameToRegex(name);
59 55
60 static PathDecoded _nameToRegex(String path) { 56 static PathDecoded _nameToRegex(String path) {
61 var keys = <String?>[]; 57 var keys = <String?>[];
@@ -36,7 +36,7 @@ class Routing { @@ -36,7 +36,7 @@ class Routing {
36 /// Extracts the name of a route based on it's instance type 36 /// Extracts the name of a route based on it's instance type
37 /// or null if not possible. 37 /// or null if not possible.
38 String? _extractRouteName(Route? route) { 38 String? _extractRouteName(Route? route) {
39 - if (route?.settings?.name != null) { 39 + if (route?.settings.name != null) {
40 return route!.settings.name; 40 return route!.settings.name;
41 } 41 }
42 42
@@ -110,7 +110,7 @@ class GetObserver extends NavigatorObserver { @@ -110,7 +110,7 @@ class GetObserver extends NavigatorObserver {
110 value.current = newRoute.name ?? ''; 110 value.current = newRoute.name ?? '';
111 } 111 }
112 112
113 - value.args = route?.settings?.arguments; 113 + value.args = route.settings.arguments;
114 value.route = route; 114 value.route = route;
115 value.isBack = false; 115 value.isBack = false;
116 value.removed = ''; 116 value.removed = '';
@@ -151,7 +151,7 @@ class GetObserver extends NavigatorObserver { @@ -151,7 +151,7 @@ class GetObserver extends NavigatorObserver {
151 value.current = _extractRouteName(previousRoute) ?? ''; 151 value.current = _extractRouteName(previousRoute) ?? '';
152 } 152 }
153 153
154 - value.args = route?.settings?.arguments; 154 + value.args = route.settings.arguments;
155 value.route = previousRoute; 155 value.route = previousRoute;
156 value.isBack = true; 156 value.isBack = true;
157 value.removed = ''; 157 value.removed = '';
@@ -183,7 +183,7 @@ class GetObserver extends NavigatorObserver { @@ -183,7 +183,7 @@ class GetObserver extends NavigatorObserver {
183 value.current = newName ?? ''; 183 value.current = newName ?? '';
184 } 184 }
185 185
186 - value.args = newRoute?.settings?.arguments; 186 + value.args = newRoute?.settings.arguments;
187 value.route = newRoute; 187 value.route = newRoute;
188 value.isBack = false; 188 value.isBack = false;
189 value.removed = ''; 189 value.removed = '';
@@ -113,7 +113,7 @@ class MiddlewareRunner { @@ -113,7 +113,7 @@ class MiddlewareRunner {
113 } 113 }
114 114
115 GetPage? runOnPageCalled(GetPage? page) { 115 GetPage? runOnPageCalled(GetPage? page) {
116 - _getMiddlewares()!.forEach((element) { 116 + _getMiddlewares()?.forEach((element) {
117 page = element.onPageCalled(page); 117 page = element.onPageCalled(page);
118 }); 118 });
119 return page; 119 return page;
@@ -121,7 +121,7 @@ class MiddlewareRunner { @@ -121,7 +121,7 @@ class MiddlewareRunner {
121 121
122 RouteSettings? runRedirect(String? route) { 122 RouteSettings? runRedirect(String? route) {
123 RouteSettings? to; 123 RouteSettings? to;
124 - _getMiddlewares()!.forEach((element) { 124 + _getMiddlewares()?.forEach((element) {
125 to = element.redirect(route); 125 to = element.redirect(route);
126 }); 126 });
127 if (to != null) { 127 if (to != null) {
@@ -131,28 +131,28 @@ class MiddlewareRunner { @@ -131,28 +131,28 @@ class MiddlewareRunner {
131 } 131 }
132 132
133 List<Bindings>? runOnBindingsStart(List<Bindings>? bindings) { 133 List<Bindings>? runOnBindingsStart(List<Bindings>? bindings) {
134 - _getMiddlewares()!.forEach((element) { 134 + _getMiddlewares()?.forEach((element) {
135 bindings = element.onBindingsStart(bindings); 135 bindings = element.onBindingsStart(bindings);
136 }); 136 });
137 return bindings; 137 return bindings;
138 } 138 }
139 139
140 GetPageBuilder? runOnPageBuildStart(GetPageBuilder? page) { 140 GetPageBuilder? runOnPageBuildStart(GetPageBuilder? page) {
141 - _getMiddlewares()!.forEach((element) { 141 + _getMiddlewares()?.forEach((element) {
142 page = element.onPageBuildStart(page); 142 page = element.onPageBuildStart(page);
143 }); 143 });
144 return page; 144 return page;
145 } 145 }
146 146
147 Widget runOnPageBuilt(Widget page) { 147 Widget runOnPageBuilt(Widget page) {
148 - _getMiddlewares()!.forEach((element) { 148 + _getMiddlewares()?.forEach((element) {
149 page = element.onPageBuilt(page); 149 page = element.onPageBuilt(page);
150 }); 150 });
151 return page; 151 return page;
152 } 152 }
153 153
154 void runOnPageDispose() => 154 void runOnPageDispose() =>
155 - _getMiddlewares()!.forEach((element) => element.onPageDispose()); 155 + _getMiddlewares()?.forEach((element) => element.onPageDispose());
156 } 156 }
157 157
158 class PageRedirect { 158 class PageRedirect {
@@ -205,11 +205,11 @@ class PageRedirect { @@ -205,11 +205,11 @@ class PageRedirect {
205 205
206 /// check if redirect is needed 206 /// check if redirect is needed
207 bool needRecheck() { 207 bool needRecheck() {
208 - final match = Get.routeTree!.matchRoute(settings.name!);  
209 - Get.parameters = match?.parameters; 208 + final match = Get.routeTree.matchRoute(settings.name!);
  209 + Get.parameters = match.parameters;
210 210
211 // No Match found 211 // No Match found
212 - if (match?.route == null) { 212 + if (match.route == null) {
213 isUnknown = true; 213 isUnknown = true;
214 return false; 214 return false;
215 } 215 }
@@ -233,12 +233,8 @@ class PageRedirect { @@ -233,12 +233,8 @@ class PageRedirect {
233 void addPageParameter(GetPage route) { 233 void addPageParameter(GetPage route) {
234 if (route.parameter == null) return; 234 if (route.parameter == null) return;
235 235
236 - if (Get.parameters == null) {  
237 - Get.parameters = route.parameter!;  
238 - } else {  
239 - final parameters = Get.parameters;  
240 - parameters.addEntries(route.parameter!.entries);  
241 - Get.parameters = parameters;  
242 - } 236 + final parameters = Get.parameters;
  237 + parameters.addEntries(route.parameter!.entries);
  238 + Get.parameters = parameters;
243 } 239 }
244 } 240 }
@@ -601,10 +601,9 @@ Set either a message or messageText"""); @@ -601,10 +601,9 @@ Set either a message or messageText""");
601 ), 601 ),
602 ), 602 ),
603 Padding( 603 Padding(
604 - padding: EdgeInsets.only(right: buttonRightPadding),  
605 - child: _getMainActionButton(),  
606 - ) ??  
607 - _emptyWidget, 604 + padding: EdgeInsets.only(right: buttonRightPadding),
  605 + child: _getMainActionButton(),
  606 + ),
608 ]; 607 ];
609 } 608 }
610 } 609 }
@@ -176,8 +176,7 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -176,8 +176,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
176 AnimationController createAnimationController() { 176 AnimationController createAnimationController() {
177 assert(!_transitionCompleter.isCompleted, 177 assert(!_transitionCompleter.isCompleted,
178 'Cannot reuse a $runtimeType after disposing it.'); 178 'Cannot reuse a $runtimeType after disposing it.');
179 - assert(snack.animationDuration != null &&  
180 - snack.animationDuration >= Duration.zero); 179 + assert(snack.animationDuration >= Duration.zero);
181 return AnimationController( 180 return AnimationController(
182 duration: snack.animationDuration, 181 duration: snack.animationDuration,
183 debugLabel: debugLabel, 182 debugLabel: debugLabel,
@@ -14,59 +14,61 @@ class MiniSubscription<T> { @@ -14,59 +14,61 @@ class MiniSubscription<T> {
14 final Callback? onDone; 14 final Callback? onDone;
15 final bool cancelOnError; 15 final bool cancelOnError;
16 16
17 - Future<void> cancel() async => listener!.removeListener(this); 17 + Future<void> cancel() async => listener.removeListener(this);
18 18
19 - final FastList<T>? listener; 19 + final FastList<T> listener;
20 } 20 }
21 21
22 class MiniStream<T> { 22 class MiniStream<T> {
23 - FastList<T?>? listenable = FastList<T>(); 23 + FastList<T> listenable = FastList<T>();
24 24
25 - T? _value; 25 + late T _value;
26 26
27 - T? get value => _value; 27 + T get value => _value;
28 28
29 - set value(T? val) { 29 + set value(T val) {
30 add(val); 30 add(val);
31 } 31 }
32 32
33 - void add(T? event) {  
34 - assert(listenable != null); 33 + void add(T event) {
35 _value = event; 34 _value = event;
36 - listenable!._notifyData(event); 35 + listenable._notifyData(event);
37 } 36 }
38 37
39 void addError(Object error, [StackTrace? stackTrace]) { 38 void addError(Object error, [StackTrace? stackTrace]) {
40 - assert(listenable != null);  
41 - listenable!._notifyError(error, stackTrace); 39 + listenable._notifyError(error, stackTrace);
42 } 40 }
43 41
44 - int get length => listenable!.length; 42 + int get length => listenable.length;
45 43
46 - bool get hasListeners => listenable!.isNotEmpty; 44 + bool get hasListeners => listenable.isNotEmpty;
47 45
48 - bool get isClosed => listenable == null; 46 + bool get isClosed => _isClosed;
49 47
50 - MiniSubscription<T?> listen(void Function(T? event) onData,  
51 - {Function? onError, void Function()? onDone, bool cancelOnError = false}) {  
52 - final subs = MiniSubscription<T?>( 48 + MiniSubscription<T> listen(void Function(T event) onData,
  49 + {Function? onError,
  50 + void Function()? onDone,
  51 + bool cancelOnError = false}) {
  52 + final subs = MiniSubscription<T>(
53 onData, 53 onData,
54 onError, 54 onError,
55 onDone, 55 onDone,
56 cancelOnError, 56 cancelOnError,
57 listenable, 57 listenable,
58 ); 58 );
59 - listenable!.addListener(subs); 59 + listenable.addListener(subs);
60 return subs; 60 return subs;
61 } 61 }
62 62
  63 + bool _isClosed = false;
  64 +
63 void close() { 65 void close() {
64 - if (listenable == null) { 66 + if (_isClosed) {
65 throw 'You can not close a closed Stream'; 67 throw 'You can not close a closed Stream';
66 } 68 }
67 - listenable!._notifyDone();  
68 - listenable = null;  
69 - _value = null; 69 + listenable._notifyDone();
  70 + listenable.clear();
  71 + _isClosed = true;
70 } 72 }
71 } 73 }
72 74
@@ -74,18 +76,18 @@ class FastList<T> { @@ -74,18 +76,18 @@ class FastList<T> {
74 Node<MiniSubscription<T>>? _head; 76 Node<MiniSubscription<T>>? _head;
75 77
76 void _notifyData(T data) { 78 void _notifyData(T data) {
77 - var currentNode = _head!; 79 + var currentNode = _head;
78 do { 80 do {
79 - currentNode.data!.data(data);  
80 - currentNode = currentNode.next!; 81 + currentNode?.data?.data(data);
  82 + currentNode = currentNode?.next;
81 } while (currentNode != null); 83 } while (currentNode != null);
82 } 84 }
83 85
84 void _notifyDone() { 86 void _notifyDone() {
85 - var currentNode = _head!; 87 + var currentNode = _head;
86 do { 88 do {
87 - currentNode.data!.onDone?.call();  
88 - currentNode = currentNode.next!; 89 + currentNode?.data?.onDone?.call();
  90 + currentNode = currentNode?.next;
89 } while (currentNode != null); 91 } while (currentNode != null);
90 } 92 }
91 93
@@ -164,6 +166,13 @@ class FastList<T> { @@ -164,6 +166,13 @@ class FastList<T> {
164 } 166 }
165 } 167 }
166 168
  169 + void clear() {
  170 + var length = this.length;
  171 + for (var i = 0; i < length; i++) {
  172 + _removeAt(i);
  173 + }
  174 + }
  175 +
167 MiniSubscription<T>? _removeAt(int position) { 176 MiniSubscription<T>? _removeAt(int position) {
168 var index = 0; 177 var index = 0;
169 var currentNode = _head; 178 var currentNode = _head;
1 library rx_stream; 1 library rx_stream;
2 2
3 import 'dart:async'; 3 import 'dart:async';
  4 +
4 import '../rx_typedefs/rx_typedefs.dart'; 5 import '../rx_typedefs/rx_typedefs.dart';
5 6
6 part 'get_stream.dart'; 7 part 'get_stream.dart';
@@ -408,18 +408,18 @@ class RxDouble extends _BaseRxNum<double?> { @@ -408,18 +408,18 @@ class RxDouble extends _BaseRxNum<double?> {
408 double truncateToDouble() => value!.truncateToDouble(); 408 double truncateToDouble() => value!.truncateToDouble();
409 } 409 }
410 410
411 -class RxInt extends _BaseRxNum<int?> {  
412 - RxInt([int? initial]) : super(initial); 411 +class RxInt extends _BaseRxNum<int> {
  412 + RxInt(int initial) : super(initial);
413 413
414 /// Addition operator. 414 /// Addition operator.
415 RxInt operator +(int other) { 415 RxInt operator +(int other) {
416 - value = value! + other; 416 + value = value + other;
417 return this; 417 return this;
418 } 418 }
419 419
420 /// Subtraction operator. 420 /// Subtraction operator.
421 RxInt operator -(int other) { 421 RxInt operator -(int other) {
422 - value = value! - other; 422 + value = value - other;
423 return this; 423 return this;
424 } 424 }
425 425
@@ -431,7 +431,7 @@ class RxInt extends _BaseRxNum<int?> { @@ -431,7 +431,7 @@ class RxInt extends _BaseRxNum<int?> {
431 /// 431 ///
432 /// If both operands are negative, the result is negative, otherwise 432 /// If both operands are negative, the result is negative, otherwise
433 /// the result is non-negative. 433 /// the result is non-negative.
434 - int operator &(int other) => value! & other; 434 + int operator &(int other) => value & other;
435 435
436 /// Bit-wise or operator. 436 /// Bit-wise or operator.
437 /// 437 ///
@@ -441,7 +441,7 @@ class RxInt extends _BaseRxNum<int?> { @@ -441,7 +441,7 @@ class RxInt extends _BaseRxNum<int?> {
441 /// 441 ///
442 /// If both operands are non-negative, the result is non-negative, 442 /// If both operands are non-negative, the result is non-negative,
443 /// otherwise the result is negative. 443 /// otherwise the result is negative.
444 - int operator |(int other) => value! | other; 444 + int operator |(int other) => value | other;
445 445
446 /// Bit-wise exclusive-or operator. 446 /// Bit-wise exclusive-or operator.
447 /// 447 ///
@@ -451,7 +451,7 @@ class RxInt extends _BaseRxNum<int?> { @@ -451,7 +451,7 @@ class RxInt extends _BaseRxNum<int?> {
451 /// 451 ///
452 /// If the operands have the same sign, the result is non-negative, 452 /// If the operands have the same sign, the result is non-negative,
453 /// otherwise the result is negative. 453 /// otherwise the result is negative.
454 - int operator ^(int other) => value! ^ other; 454 + int operator ^(int other) => value ^ other;
455 455
456 /// The bit-wise negate operator. 456 /// The bit-wise negate operator.
457 /// 457 ///
@@ -459,7 +459,7 @@ class RxInt extends _BaseRxNum<int?> { @@ -459,7 +459,7 @@ class RxInt extends _BaseRxNum<int?> {
459 /// the result is a number with the opposite bits set. 459 /// the result is a number with the opposite bits set.
460 /// 460 ///
461 /// This maps any integer `x` to `-x - 1`. 461 /// This maps any integer `x` to `-x - 1`.
462 - int operator ~() => ~value!; 462 + int operator ~() => ~value;
463 463
464 /// Shift the bits of this integer to the left by [shiftAmount]. 464 /// Shift the bits of this integer to the left by [shiftAmount].
465 /// 465 ///
@@ -471,7 +471,7 @@ class RxInt extends _BaseRxNum<int?> { @@ -471,7 +471,7 @@ class RxInt extends _BaseRxNum<int?> {
471 /// mask. 471 /// mask.
472 /// 472 ///
473 /// It is an error if [shiftAmount] is negative. 473 /// It is an error if [shiftAmount] is negative.
474 - int operator <<(int shiftAmount) => value! << shiftAmount; 474 + int operator <<(int shiftAmount) => value << shiftAmount;
475 475
476 /// Shift the bits of this integer to the right by [shiftAmount]. 476 /// Shift the bits of this integer to the right by [shiftAmount].
477 /// 477 ///
@@ -480,13 +480,13 @@ class RxInt extends _BaseRxNum<int?> { @@ -480,13 +480,13 @@ class RxInt extends _BaseRxNum<int?> {
480 ///`pow(2, shiftIndex)`. 480 ///`pow(2, shiftIndex)`.
481 /// 481 ///
482 /// It is an error if [shiftAmount] is negative. 482 /// It is an error if [shiftAmount] is negative.
483 - int operator >>(int shiftAmount) => value! >> shiftAmount; 483 + int operator >>(int shiftAmount) => value >> shiftAmount;
484 484
485 /// Returns this integer to the power of [exponent] modulo [modulus]. 485 /// Returns this integer to the power of [exponent] modulo [modulus].
486 /// 486 ///
487 /// The [exponent] must be non-negative and [modulus] must be 487 /// The [exponent] must be non-negative and [modulus] must be
488 /// positive. 488 /// positive.
489 - int modPow(int exponent, int modulus) => value!.modPow(exponent, modulus); 489 + int modPow(int exponent, int modulus) => value.modPow(exponent, modulus);
490 490
491 /// Returns the modular multiplicative inverse of this integer 491 /// Returns the modular multiplicative inverse of this integer
492 /// modulo [modulus]. 492 /// modulo [modulus].
@@ -494,7 +494,7 @@ class RxInt extends _BaseRxNum<int?> { @@ -494,7 +494,7 @@ class RxInt extends _BaseRxNum<int?> {
494 /// The [modulus] must be positive. 494 /// The [modulus] must be positive.
495 /// 495 ///
496 /// It is an error if no modular inverse exists. 496 /// It is an error if no modular inverse exists.
497 - int modInverse(int modulus) => value!.modInverse(modulus); 497 + int modInverse(int modulus) => value.modInverse(modulus);
498 498
499 /// Returns the greatest common divisor of this integer and [other]. 499 /// Returns the greatest common divisor of this integer and [other].
500 /// 500 ///
@@ -507,13 +507,13 @@ class RxInt extends _BaseRxNum<int?> { @@ -507,13 +507,13 @@ class RxInt extends _BaseRxNum<int?> {
507 /// For any integer `x`, `x.gcd(x)` is `x.abs()`. 507 /// For any integer `x`, `x.gcd(x)` is `x.abs()`.
508 /// 508 ///
509 /// If both `this` and `other` is zero, the result is also zero. 509 /// If both `this` and `other` is zero, the result is also zero.
510 - int gcd(int other) => value!.gcd(other); 510 + int gcd(int other) => value.gcd(other);
511 511
512 /// Returns true if and only if this integer is even. 512 /// Returns true if and only if this integer is even.
513 - bool get isEven => value!.isEven; 513 + bool get isEven => value.isEven;
514 514
515 /// Returns true if and only if this integer is odd. 515 /// Returns true if and only if this integer is odd.
516 - bool get isOdd => value!.isOdd; 516 + bool get isOdd => value.isOdd;
517 517
518 /// Returns the minimum number of bits required to store this integer. 518 /// Returns the minimum number of bits required to store this integer.
519 /// 519 ///
@@ -535,7 +535,7 @@ class RxInt extends _BaseRxNum<int?> { @@ -535,7 +535,7 @@ class RxInt extends _BaseRxNum<int?> {
535 /// (-3).bitLength == 2; // 11111101 535 /// (-3).bitLength == 2; // 11111101
536 /// (-4).bitLength == 2; // 11111100 536 /// (-4).bitLength == 2; // 11111100
537 /// ``` 537 /// ```
538 - int get bitLength => value!.bitLength; 538 + int get bitLength => value.bitLength;
539 539
540 /// Returns the least significant [width] bits of this integer as a 540 /// Returns the least significant [width] bits of this integer as a
541 /// non-negative number (i.e. unsigned representation). The returned value 541 /// non-negative number (i.e. unsigned representation). The returned value
@@ -557,7 +557,7 @@ class RxInt extends _BaseRxNum<int?> { @@ -557,7 +557,7 @@ class RxInt extends _BaseRxNum<int?> {
557 /// ``` 557 /// ```
558 /// x == x.toUnsigned(x.bitLength); 558 /// x == x.toUnsigned(x.bitLength);
559 /// ``` 559 /// ```
560 - int toUnsigned(int width) => value!.toUnsigned(width); 560 + int toUnsigned(int width) => value.toUnsigned(width);
561 561
562 /// Returns the least significant [width] bits of this integer, extending the 562 /// Returns the least significant [width] bits of this integer, extending the
563 /// highest retained bit to the sign. This is the same as truncating the 563 /// highest retained bit to the sign. This is the same as truncating the
@@ -587,57 +587,57 @@ class RxInt extends _BaseRxNum<int?> { @@ -587,57 +587,57 @@ class RxInt extends _BaseRxNum<int?> {
587 /// ``` 587 /// ```
588 /// x == x.toSigned(x.bitLength + 1); 588 /// x == x.toSigned(x.bitLength + 1);
589 /// ``` 589 /// ```
590 - int toSigned(int width) => value!.toSigned(width); 590 + int toSigned(int width) => value.toSigned(width);
591 591
592 /// Return the negative value of this integer. 592 /// Return the negative value of this integer.
593 /// 593 ///
594 /// The result of negating an integer always has the opposite sign, except 594 /// The result of negating an integer always has the opposite sign, except
595 /// for zero, which is its own negation. 595 /// for zero, which is its own negation.
596 @override 596 @override
597 - int operator -() => -value!; 597 + int operator -() => -value;
598 598
599 /// Returns the absolute value of this integer. 599 /// Returns the absolute value of this integer.
600 /// 600 ///
601 /// For any integer `x`, the result is the same as `x < 0 ? -x : x`. 601 /// For any integer `x`, the result is the same as `x < 0 ? -x : x`.
602 @override 602 @override
603 - int abs() => value!.abs(); 603 + int abs() => value.abs();
604 604
605 /// Returns the sign of this integer. 605 /// Returns the sign of this integer.
606 /// 606 ///
607 /// Returns 0 for zero, -1 for values less than zero and 607 /// Returns 0 for zero, -1 for values less than zero and
608 /// +1 for values greater than zero. 608 /// +1 for values greater than zero.
609 @override 609 @override
610 - int get sign => value!.sign; 610 + int get sign => value.sign;
611 611
612 /// Returns `this`. 612 /// Returns `this`.
613 @override 613 @override
614 - int round() => value!.round(); 614 + int round() => value.round();
615 615
616 /// Returns `this`. 616 /// Returns `this`.
617 @override 617 @override
618 - int floor() => value!.floor(); 618 + int floor() => value.floor();
619 619
620 /// Returns `this`. 620 /// Returns `this`.
621 @override 621 @override
622 - int ceil() => value!.ceil(); 622 + int ceil() => value.ceil();
623 623
624 /// Returns `this`. 624 /// Returns `this`.
625 @override 625 @override
626 - int truncate() => value!.truncate(); 626 + int truncate() => value.truncate();
627 627
628 /// Returns `this.toDouble()`. 628 /// Returns `this.toDouble()`.
629 @override 629 @override
630 - double roundToDouble() => value!.roundToDouble(); 630 + double roundToDouble() => value.roundToDouble();
631 631
632 /// Returns `this.toDouble()`. 632 /// Returns `this.toDouble()`.
633 @override 633 @override
634 - double floorToDouble() => value!.floorToDouble(); 634 + double floorToDouble() => value.floorToDouble();
635 635
636 /// Returns `this.toDouble()`. 636 /// Returns `this.toDouble()`.
637 @override 637 @override
638 - double ceilToDouble() => value!.ceilToDouble(); 638 + double ceilToDouble() => value.ceilToDouble();
639 639
640 /// Returns `this.toDouble()`. 640 /// Returns `this.toDouble()`.
641 @override 641 @override
642 - double truncateToDouble() => value!.truncateToDouble(); 642 + double truncateToDouble() => value.truncateToDouble();
643 } 643 }
@@ -5,9 +5,7 @@ class RxList<E> extends ListMixin<E> @@ -5,9 +5,7 @@ class RxList<E> extends ListMixin<E>
5 with NotifyManager<List<E>>, RxObjectMixin<List<E>> 5 with NotifyManager<List<E>>, RxObjectMixin<List<E>>
6 implements RxInterface<List<E>> { 6 implements RxInterface<List<E>> {
7 RxList([List<E> initial = const []]) { 7 RxList([List<E> initial = const []]) {
8 - if (initial != null) {  
9 - _value = List.from(initial);  
10 - } 8 + _value = List.from(initial);
11 } 9 }
12 10
13 factory RxList.filled(int length, E fill, {bool growable = false}) { 11 factory RxList.filled(int length, E fill, {bool growable = false}) {
@@ -40,11 +38,11 @@ class RxList<E> extends ListMixin<E> @@ -40,11 +38,11 @@ class RxList<E> extends ListMixin<E>
40 } 38 }
41 39
42 @override 40 @override
43 - Iterator<E> get iterator => value!.iterator; 41 + Iterator<E> get iterator => value.iterator;
44 42
45 @override 43 @override
46 void operator []=(int index, E val) { 44 void operator []=(int index, E val) {
47 - _value![index] = val; 45 + _value[index] = val;
48 refresh(); 46 refresh();
49 } 47 }
50 48
@@ -59,18 +57,18 @@ class RxList<E> extends ListMixin<E> @@ -59,18 +57,18 @@ class RxList<E> extends ListMixin<E>
59 57
60 @override 58 @override
61 E operator [](int index) { 59 E operator [](int index) {
62 - return value![index]; 60 + return value[index];
63 } 61 }
64 62
65 @override 63 @override
66 void add(E item) { 64 void add(E item) {
67 - _value!.add(item); 65 + _value.add(item);
68 refresh(); 66 refresh();
69 } 67 }
70 68
71 @override 69 @override
72 void addAll(Iterable<E> item) { 70 void addAll(Iterable<E> item) {
73 - _value!.addAll(item); 71 + _value.addAll(item);
74 refresh(); 72 refresh();
75 } 73 }
76 74
@@ -103,17 +101,17 @@ class RxList<E> extends ListMixin<E> @@ -103,17 +101,17 @@ class RxList<E> extends ListMixin<E>
103 101
104 @override 102 @override
105 Iterable<E> where(bool Function(E) test) { 103 Iterable<E> where(bool Function(E) test) {
106 - return value!.where(test); 104 + return value.where(test);
107 } 105 }
108 106
109 @override 107 @override
110 Iterable<T> whereType<T>() { 108 Iterable<T> whereType<T>() {
111 - return value!.whereType<T>(); 109 + return value.whereType<T>();
112 } 110 }
113 111
114 @override 112 @override
115 void sort([int compare(E a, E b)?]) { 113 void sort([int compare(E a, E b)?]) {
116 - _value!.sort(compare); 114 + _value.sort(compare);
117 refresh(); 115 refresh();
118 } 116 }
119 } 117 }
@@ -126,10 +124,10 @@ extension ListExtension<E> on List<E> { @@ -126,10 +124,10 @@ extension ListExtension<E> on List<E> {
126 if (item != null) add(item); 124 if (item != null) add(item);
127 } 125 }
128 126
129 - /// Add [Iterable<E>] to [List<E>] only if [Iterable<E>] is not null.  
130 - void addAllNonNull(Iterable<E> item) {  
131 - if (item != null) addAll(item);  
132 - } 127 + // /// Add [Iterable<E>] to [List<E>] only if [Iterable<E>] is not null.
  128 + // void addAllNonNull(Iterable<E> item) {
  129 + // if (item != null) addAll(item);
  130 + // }
133 131
134 /// Add [item] to [List<E>] only if [condition] is true. 132 /// Add [item] to [List<E>] only if [condition] is true.
135 void addIf(dynamic condition, E item) { 133 void addIf(dynamic condition, E item) {
@@ -146,7 +144,7 @@ extension ListExtension<E> on List<E> { @@ -146,7 +144,7 @@ extension ListExtension<E> on List<E> {
146 /// Replaces all existing items of this list with [item] 144 /// Replaces all existing items of this list with [item]
147 void assign(E item) { 145 void assign(E item) {
148 if (this is RxList) { 146 if (this is RxList) {
149 - (this as RxList)._value ??= <E>[]; 147 + (this as RxList)._value;
150 } 148 }
151 149
152 clear(); 150 clear();
@@ -156,7 +154,7 @@ extension ListExtension<E> on List<E> { @@ -156,7 +154,7 @@ extension ListExtension<E> on List<E> {
156 /// Replaces all existing items of this list with [items] 154 /// Replaces all existing items of this list with [items]
157 void assignAll(Iterable<E> items) { 155 void assignAll(Iterable<E> items) {
158 if (this is RxList) { 156 if (this is RxList) {
159 - (this as RxList)._value ??= <E>[]; 157 + (this as RxList)._value;
160 } 158 }
161 clear(); 159 clear();
162 addAll(items); 160 addAll(items);
@@ -4,9 +4,7 @@ class RxMap<K, V> extends MapMixin<K, V> @@ -4,9 +4,7 @@ class RxMap<K, V> extends MapMixin<K, V>
4 with NotifyManager<Map<K, V>>, RxObjectMixin<Map<K, V>> 4 with NotifyManager<Map<K, V>>, RxObjectMixin<Map<K, V>>
5 implements RxInterface<Map<K, V>> { 5 implements RxInterface<Map<K, V>> {
6 RxMap([Map<K, V> initial = const {}]) { 6 RxMap([Map<K, V> initial = const {}]) {
7 - if (initial != null) {  
8 - _value = Map.from(initial);  
9 - } 7 + _value = Map.from(initial);
10 } 8 }
11 9
12 factory RxMap.from(Map<K, V> other) { 10 factory RxMap.from(Map<K, V> other) {
@@ -30,27 +28,27 @@ class RxMap<K, V> extends MapMixin<K, V> @@ -30,27 +28,27 @@ class RxMap<K, V> extends MapMixin<K, V>
30 28
31 @override 29 @override
32 V? operator [](Object? key) { 30 V? operator [](Object? key) {
33 - return value![key as K]; 31 + return value[key as K];
34 } 32 }
35 33
36 @override 34 @override
37 void operator []=(K key, V value) { 35 void operator []=(K key, V value) {
38 - _value![key] = value; 36 + _value[key] = value;
39 refresh(); 37 refresh();
40 } 38 }
41 39
42 @override 40 @override
43 void clear() { 41 void clear() {
44 - _value!.clear(); 42 + _value.clear();
45 refresh(); 43 refresh();
46 } 44 }
47 45
48 @override 46 @override
49 - Iterable<K> get keys => value!.keys; 47 + Iterable<K> get keys => value.keys;
50 48
51 @override 49 @override
52 V? remove(Object? key) { 50 V? remove(Object? key) {
53 - final val = _value!.remove(key); 51 + final val = _value.remove(key);
54 refresh(); 52 refresh();
55 return val; 53 return val;
56 } 54 }
@@ -85,8 +83,8 @@ extension MapExtension<K, V> on Map<K, V> { @@ -85,8 +83,8 @@ extension MapExtension<K, V> on Map<K, V> {
85 void assign(K key, V val) { 83 void assign(K key, V val) {
86 if (this is RxMap) { 84 if (this is RxMap) {
87 final map = (this as RxMap); 85 final map = (this as RxMap);
88 - map._value ??= <K, V>{};  
89 - map._value!.clear(); 86 + map._value;
  87 + map._value.clear();
90 this[key] = val; 88 this[key] = val;
91 } else { 89 } else {
92 clear(); 90 clear();
@@ -4,9 +4,7 @@ class RxSet<E> extends SetMixin<E> @@ -4,9 +4,7 @@ class RxSet<E> extends SetMixin<E>
4 with NotifyManager<Set<E>>, RxObjectMixin<Set<E>> 4 with NotifyManager<Set<E>>, RxObjectMixin<Set<E>>
5 implements RxInterface<Set<E>> { 5 implements RxInterface<Set<E>> {
6 RxSet([Set<E> initial = const {}]) { 6 RxSet([Set<E> initial = const {}]) {
7 - if (initial != null) {  
8 - _value = Set.from(initial);  
9 - } 7 + _value = Set.from(initial);
10 } 8 }
11 9
12 /// Special override to push() element(s) in a reactive way 10 /// Special override to push() element(s) in a reactive way
@@ -41,30 +39,30 @@ class RxSet<E> extends SetMixin<E> @@ -41,30 +39,30 @@ class RxSet<E> extends SetMixin<E>
41 39
42 @override 40 @override
43 bool add(E value) { 41 bool add(E value) {
44 - final val = _value!.add(value); 42 + final val = _value.add(value);
45 refresh(); 43 refresh();
46 return val; 44 return val;
47 } 45 }
48 46
49 @override 47 @override
50 bool contains(Object? element) { 48 bool contains(Object? element) {
51 - return value!.contains(element); 49 + return value.contains(element);
52 } 50 }
53 51
54 @override 52 @override
55 - Iterator<E> get iterator => value!.iterator; 53 + Iterator<E> get iterator => value.iterator;
56 54
57 @override 55 @override
58 - int get length => value!.length; 56 + int get length => value.length;
59 57
60 @override 58 @override
61 E? lookup(Object? object) { 59 E? lookup(Object? object) {
62 - return value!.lookup(object); 60 + return value.lookup(object);
63 } 61 }
64 62
65 @override 63 @override
66 bool remove(Object? item) { 64 bool remove(Object? item) {
67 - var hasRemoved = _value!.remove(item); 65 + var hasRemoved = _value.remove(item);
68 if (hasRemoved) { 66 if (hasRemoved) {
69 refresh(); 67 refresh();
70 } 68 }
@@ -73,36 +71,36 @@ class RxSet<E> extends SetMixin<E> @@ -73,36 +71,36 @@ class RxSet<E> extends SetMixin<E>
73 71
74 @override 72 @override
75 Set<E> toSet() { 73 Set<E> toSet() {
76 - return value!.toSet(); 74 + return value.toSet();
77 } 75 }
78 76
79 @override 77 @override
80 void addAll(Iterable<E> item) { 78 void addAll(Iterable<E> item) {
81 - _value!.addAll(item); 79 + _value.addAll(item);
82 refresh(); 80 refresh();
83 } 81 }
84 82
85 @override 83 @override
86 void clear() { 84 void clear() {
87 - _value!.clear(); 85 + _value.clear();
88 refresh(); 86 refresh();
89 } 87 }
90 88
91 @override 89 @override
92 void removeAll(Iterable<Object?> elements) { 90 void removeAll(Iterable<Object?> elements) {
93 - _value!.removeAll(elements); 91 + _value.removeAll(elements);
94 refresh(); 92 refresh();
95 } 93 }
96 94
97 @override 95 @override
98 void retainAll(Iterable<Object?> elements) { 96 void retainAll(Iterable<Object?> elements) {
99 - _value!.retainAll(elements); 97 + _value.retainAll(elements);
100 refresh(); 98 refresh();
101 } 99 }
102 100
103 @override 101 @override
104 void retainWhere(bool Function(E) E) { 102 void retainWhere(bool Function(E) E) {
105 - _value!.retainWhere(E); 103 + _value.retainWhere(E);
106 refresh(); 104 refresh();
107 } 105 }
108 } 106 }
@@ -137,7 +135,7 @@ extension SetExtension<E> on Set<E> { @@ -137,7 +135,7 @@ extension SetExtension<E> on Set<E> {
137 /// Replaces all existing items of this list with [item] 135 /// Replaces all existing items of this list with [item]
138 void assign(E item) { 136 void assign(E item) {
139 if (this is RxSet) { 137 if (this is RxSet) {
140 - (this as RxSet)._value ??= <E>{}; 138 + (this as RxSet)._value;
141 } 139 }
142 140
143 clear(); 141 clear();
@@ -147,7 +145,7 @@ extension SetExtension<E> on Set<E> { @@ -147,7 +145,7 @@ extension SetExtension<E> on Set<E> {
147 /// Replaces all existing items of this list with [items] 145 /// Replaces all existing items of this list with [items]
148 void assignAll(Iterable<E> items) { 146 void assignAll(Iterable<E> items) {
149 if (this is RxSet) { 147 if (this is RxSet) {
150 - (this as RxSet)._value ??= <E>{}; 148 + (this as RxSet)._value;
151 } 149 }
152 clear(); 150 clear();
153 addAll(items); 151 addAll(items);
@@ -184,7 +184,6 @@ Worker interval<T>( @@ -184,7 +184,6 @@ Worker interval<T>(
184 bool? cancelOnError, 184 bool? cancelOnError,
185 }) { 185 }) {
186 var debounceActive = false; 186 var debounceActive = false;
187 - time ??= const Duration(seconds: 1);  
188 StreamSubscription sub = listener.listen( 187 StreamSubscription sub = listener.listen(
189 (event) async { 188 (event) async {
190 if (debounceActive || !_conditional(condition)) return; 189 if (debounceActive || !_conditional(condition)) return;
@@ -67,7 +67,7 @@ class GetXState<T extends DisposableInterface> extends State<GetX<T>> { @@ -67,7 +67,7 @@ class GetXState<T extends DisposableInterface> extends State<GetX<T>> {
67 } else { 67 } else {
68 controller = widget.init; 68 controller = widget.init;
69 isCreator = true; 69 isCreator = true;
70 - GetInstance().put<T?>(controller, tag: widget.tag); 70 + GetInstance().put<T>(controller!, tag: widget.tag);
71 } 71 }
72 } else { 72 } else {
73 controller = widget.init; 73 controller = widget.init;
@@ -138,7 +138,6 @@ extension StateExt<T> on StateMixin<T> { @@ -138,7 +138,6 @@ extension StateExt<T> on StateMixin<T> {
138 Widget? onLoading, 138 Widget? onLoading,
139 Widget? onEmpty, 139 Widget? onEmpty,
140 }) { 140 }) {
141 - assert(widget != null);  
142 return SimpleBuilder(builder: (_) { 141 return SimpleBuilder(builder: (_) {
143 if (status.isLoading) { 142 if (status.isLoading) {
144 return onLoading ?? const Center(child: CircularProgressIndicator()); 143 return onLoading ?? const Center(child: CircularProgressIndicator());
@@ -51,7 +51,7 @@ typedef GetControllerBuilder<T extends DisposableInterface> = Widget Function( @@ -51,7 +51,7 @@ typedef GetControllerBuilder<T extends DisposableInterface> = Widget Function(
51 // } 51 // }
52 // } 52 // }
53 53
54 -class GetBuilder<T extends GetxController?> extends StatefulWidget { 54 +class GetBuilder<T extends GetxController> extends StatefulWidget {
55 final GetControllerBuilder<T> builder; 55 final GetControllerBuilder<T> builder;
56 final bool global; 56 final bool global;
57 final Object? id; 57 final Object? id;
@@ -77,8 +77,7 @@ class GetBuilder<T extends GetxController?> extends StatefulWidget { @@ -77,8 +77,7 @@ class GetBuilder<T extends GetxController?> extends StatefulWidget {
77 this.id, 77 this.id,
78 this.didChangeDependencies, 78 this.didChangeDependencies,
79 this.didUpdateWidget, 79 this.didUpdateWidget,
80 - }) : assert(builder != null),  
81 - super(key: key); 80 + }) : super(key: key);
82 81
83 // static T of<T extends GetxController>( 82 // static T of<T extends GetxController>(
84 // BuildContext context, { 83 // BuildContext context, {
@@ -103,7 +102,7 @@ class GetBuilder<T extends GetxController?> extends StatefulWidget { @@ -103,7 +102,7 @@ class GetBuilder<T extends GetxController?> extends StatefulWidget {
103 _GetBuilderState<T> createState() => _GetBuilderState<T>(); 102 _GetBuilderState<T> createState() => _GetBuilderState<T>();
104 } 103 }
105 104
106 -class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>> 105 +class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>>
107 with GetStateUpdaterMixin { 106 with GetStateUpdaterMixin {
108 T? controller; 107 T? controller;
109 bool? isCreator = false; 108 bool? isCreator = false;
@@ -136,7 +135,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>> @@ -136,7 +135,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
136 } else { 135 } else {
137 controller = widget.init; 136 controller = widget.init;
138 isCreator = true; 137 isCreator = true;
139 - GetInstance().put<T?>(controller, tag: widget.tag); 138 + GetInstance().put<T>(controller!, tag: widget.tag);
140 } 139 }
141 } else { 140 } else {
142 controller = widget.init; 141 controller = widget.init;
@@ -145,7 +144,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>> @@ -145,7 +144,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
145 } 144 }
146 145
147 if (widget.filter != null) { 146 if (widget.filter != null) {
148 - _filter = widget.filter!(controller); 147 + _filter = widget.filter!(controller!);
149 } 148 }
150 149
151 _subscribeToController(); 150 _subscribeToController();
@@ -167,7 +166,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>> @@ -167,7 +166,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
167 } 166 }
168 167
169 void _filterUpdate() { 168 void _filterUpdate() {
170 - var newFilter = widget.filter!(controller); 169 + var newFilter = widget.filter!(controller!);
171 if (newFilter != _filter) { 170 if (newFilter != _filter) {
172 _filter = newFilter; 171 _filter = newFilter;
173 getUpdate(); 172 getUpdate();
@@ -201,7 +200,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>> @@ -201,7 +200,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
201 200
202 @override 201 @override
203 void didUpdateWidget(GetBuilder oldWidget) { 202 void didUpdateWidget(GetBuilder oldWidget) {
204 - super.didUpdateWidget(oldWidget as GetBuilder<T?>); 203 + super.didUpdateWidget(oldWidget as GetBuilder<T>);
205 // to avoid conflicts when modifying a "grouped" id list. 204 // to avoid conflicts when modifying a "grouped" id list.
206 if (oldWidget.id != widget.id) { 205 if (oldWidget.id != widget.id) {
207 _subscribeToController(); 206 _subscribeToController();
@@ -215,7 +214,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>> @@ -215,7 +214,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
215 // model: controller, 214 // model: controller,
216 // child: widget.builder(controller), 215 // child: widget.builder(controller),
217 // ); 216 // );
218 - return widget.builder(controller); 217 + return widget.builder(controller!);
219 } 218 }
220 } 219 }
221 220
@@ -21,7 +21,7 @@ class GetWidgetCacheElement extends ComponentElement { @@ -21,7 +21,7 @@ class GetWidgetCacheElement extends ComponentElement {
21 21
22 @override 22 @override
23 void mount(Element? parent, dynamic newSlot) { 23 void mount(Element? parent, dynamic newSlot) {
24 - cache?.onInit(); 24 + cache.onInit();
25 super.mount(parent, newSlot); 25 super.mount(parent, newSlot);
26 } 26 }
27 27
@@ -23,8 +23,7 @@ class MixinBuilder<T extends GetxController> extends StatelessWidget { @@ -23,8 +23,7 @@ class MixinBuilder<T extends GetxController> extends StatelessWidget {
23 this.id, 23 this.id,
24 this.didChangeDependencies, 24 this.didChangeDependencies,
25 this.didUpdateWidget, 25 this.didUpdateWidget,
26 - }) : assert(builder != null),  
27 - super(key: key); 26 + }) : super(key: key);
28 27
29 @override 28 @override
30 Widget build(BuildContext context) { 29 Widget build(BuildContext context) {
@@ -64,7 +64,7 @@ class _ValueBuilderState<T> extends State<ValueBuilder<T?>> { @@ -64,7 +64,7 @@ class _ValueBuilderState<T> extends State<ValueBuilder<T?>> {
64 @override 64 @override
65 void dispose() { 65 void dispose() {
66 super.dispose(); 66 super.dispose();
67 - widget?.onDispose?.call(); 67 + widget.onDispose?.call();
68 if (value is ChangeNotifier) { 68 if (value is ChangeNotifier) {
69 (value as ChangeNotifier?)?.dispose(); 69 (value as ChangeNotifier?)?.dispose();
70 } else if (value is StreamController) { 70 } else if (value is StreamController) {
@@ -78,9 +78,7 @@ class _ValueBuilderState<T> extends State<ValueBuilder<T?>> { @@ -78,9 +78,7 @@ class _ValueBuilderState<T> extends State<ValueBuilder<T?>> {
78 class SimpleBuilder extends StatefulWidget { 78 class SimpleBuilder extends StatefulWidget {
79 final Widget Function(BuildContext) builder; 79 final Widget Function(BuildContext) builder;
80 80
81 - const SimpleBuilder({Key? key, required this.builder})  
82 - : assert(builder != null),  
83 - super(key: key); 81 + const SimpleBuilder({Key? key, required this.builder}) : super(key: key);
84 82
85 @override 83 @override
86 _SimpleBuilderState createState() => _SimpleBuilderState(); 84 _SimpleBuilderState createState() => _SimpleBuilderState();
@@ -10,7 +10,8 @@ extension Trans on String? { @@ -10,7 +10,8 @@ extension Trans on String? {
10 // whether the key is also present. 10 // whether the key is also present.
11 if (Get.translations.containsKey( 11 if (Get.translations.containsKey(
12 "${Get.locale!.languageCode}_${Get.locale!.countryCode}") && 12 "${Get.locale!.languageCode}_${Get.locale!.countryCode}") &&
13 - Get.translations["${Get.locale!.languageCode}_${Get.locale!.countryCode}"]! 13 + Get.translations[
  14 + "${Get.locale!.languageCode}_${Get.locale!.countryCode}"]!
14 .containsKey(this)) { 15 .containsKey(this)) {
15 return Get.translations[ 16 return Get.translations[
16 "${Get.locale!.languageCode}_${Get.locale!.countryCode}"]![this!]; 17 "${Get.locale!.languageCode}_${Get.locale!.countryCode}"]![this!];
@@ -214,7 +214,7 @@ class GetUtils { @@ -214,7 +214,7 @@ class GetUtils {
214 214
215 /// Checks if string is phone number. 215 /// Checks if string is phone number.
216 static bool isPhoneNumber(String s) { 216 static bool isPhoneNumber(String s) {
217 - if (s == null || s.length > 16 || s.length < 9) return false; 217 + if (s.length > 16 || s.length < 9) return false;
218 return hasMatch(s, r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$'); 218 return hasMatch(s, r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$');
219 } 219 }
220 220
@@ -413,10 +413,6 @@ class GetUtils { @@ -413,10 +413,6 @@ class GetUtils {
413 413
414 //Check if num is a cnpj 414 //Check if num is a cnpj
415 static bool isCnpj(String cnpj) { 415 static bool isCnpj(String cnpj) {
416 - if (cnpj == null) {  
417 - return false;  
418 - }  
419 -  
420 // Obter somente os números do CNPJ 416 // Obter somente os números do CNPJ
421 final numbers = cnpj.replaceAll(RegExp(r'[^0-9]'), ''); 417 final numbers = cnpj.replaceAll(RegExp(r'[^0-9]'), '');
422 418
@@ -466,9 +462,9 @@ class GetUtils { @@ -466,9 +462,9 @@ class GetUtils {
466 462
467 /// Checks if the cpf is valid. 463 /// Checks if the cpf is valid.
468 static bool isCpf(String cpf) { 464 static bool isCpf(String cpf) {
469 - if (cpf == null) {  
470 - return false;  
471 - } 465 + // if (cpf == null) {
  466 + // return false;
  467 + // }
472 468
473 // get only the numbers 469 // get only the numbers
474 final numbers = cpf.replaceAll(RegExp(r'[^0-9]'), ''); 470 final numbers = cpf.replaceAll(RegExp(r'[^0-9]'), '');
@@ -148,7 +148,7 @@ referenceValue is ${calculePercentage(referenceValue, requestedValue)}% more tha @@ -148,7 +148,7 @@ referenceValue is ${calculePercentage(referenceValue, requestedValue)}% more tha
148 print('GetValue delay $getx ms to made $times requests'); 148 print('GetValue delay $getx ms to made $times requests');
149 print('-----------'); 149 print('-----------');
150 print(''' 150 print('''
151 -GetValue is ${calculePercentage(dart, getx).round()}% more fast than Default ValueNotifier with $times listeners'''); 151 +GetValue is ${calculePercentage(dart, getx).round()}% more fast than Default ValueNotifier with $times requests''');
152 }); 152 });
153 153
154 test('run benchmarks from Streams', () async { 154 test('run benchmarks from Streams', () async {
@@ -161,7 +161,7 @@ GetValue is ${calculePercentage(dart, getx).round()}% more fast than Default Val @@ -161,7 +161,7 @@ GetValue is ${calculePercentage(dart, getx).round()}% more fast than Default Val
161 var dart = await stream(); 161 var dart = await stream();
162 print('-----------'); 162 print('-----------');
163 print(''' 163 print('''
164 -GetStream is ${calculePercentage(dart, mini).round()}% more fast than Default Stream with $times listeners'''); 164 +GetStream is ${calculePercentage(dart, mini).round()}% more fast than Default Stream with $times requests''');
165 print('-----------'); 165 print('-----------');
166 166
167 times = 30000; 167 times = 30000;
@@ -179,7 +179,7 @@ GetStream is ${calculePercentage(dart, mini).round()}% more fast than Default St @@ -179,7 +179,7 @@ GetStream is ${calculePercentage(dart, mini).round()}% more fast than Default St
179 print('getx_mini_stream delay $mini ms to made $times requests'); 179 print('getx_mini_stream delay $mini ms to made $times requests');
180 print('-----------'); 180 print('-----------');
181 print(''' 181 print('''
182 -GetStream is ${calculePercentage(dart, mini).round()}% more fast than Default Stream with $times listeners'''); 182 +GetStream is ${calculePercentage(dart, mini).round()}% more fast than Default Stream with $times requests''');
183 }); 183 });
184 } 184 }
185 185
1 -import 'package:flutter_test/flutter_test.dart';  
2 -import 'package:get/get.dart'; 1 +// import 'package:flutter_test/flutter_test.dart';
  2 +// import 'package:get/get.dart';
3 3
4 void main() { 4 void main() {
5 // testWidgets( 5 // testWidgets(
1 -import 'package:flutter/material.dart';  
2 -import 'package:flutter_test/flutter_test.dart';  
3 -import 'package:get/get.dart'; 1 +// import 'package:flutter/material.dart';
  2 +// import 'package:flutter_test/flutter_test.dart';
  3 +// import 'package:get/get.dart';
4 4
5 void main() { 5 void main() {
6 // testWidgets( 6 // testWidgets(
@@ -24,7 +24,8 @@ void main() { @@ -24,7 +24,8 @@ void main() {
24 // "GetPage name null", 24 // "GetPage name null",
25 // (tester) async { 25 // (tester) async {
26 // expect( 26 // expect(
27 - // () => GetPage(page: () => Scaffold(), maintainState: null, name: null), 27 + // () => GetPage(page: () => Scaffold(),
  28 + // maintainState: null, name: null),
28 // throwsAssertionError, 29 // throwsAssertionError,
29 // ); 30 // );
30 // }, 31 // },
@@ -6,9 +6,9 @@ import 'package:get/get.dart'; @@ -6,9 +6,9 @@ import 'package:get/get.dart';
6 void main() { 6 void main() {
7 test('once', () async { 7 test('once', () async {
8 final count = 0.obs; 8 final count = 0.obs;
9 - int? result = -1; 9 + var result = -1;
10 once(count, (dynamic _) { 10 once(count, (dynamic _) {
11 - result = _ as int?; 11 + result = _ as int;
12 }); 12 });
13 count.value++; 13 count.value++;
14 await Future.delayed(Duration.zero); 14 await Future.delayed(Duration.zero);
@@ -23,9 +23,9 @@ void main() { @@ -23,9 +23,9 @@ void main() {
23 23
24 test('ever', () async { 24 test('ever', () async {
25 final count = 0.obs; 25 final count = 0.obs;
26 - int? result = -1;  
27 - ever(count, (dynamic _) {  
28 - result = _ as int?; 26 + var result = -1;
  27 + ever<int>(count, (value) {
  28 + result = value;
29 }); 29 });
30 count.value++; 30 count.value++;
31 await Future.delayed(Duration.zero); 31 await Future.delayed(Duration.zero);
@@ -68,18 +68,18 @@ void main() { @@ -68,18 +68,18 @@ void main() {
68 expect(find.text("single 0"), findsOneWidget); 68 expect(find.text("single 0"), findsOneWidget);
69 }); 69 });
70 70
71 - testWidgets(  
72 - "MixinBuilder with build null",  
73 - (test) async {  
74 - expect(  
75 - () => GetBuilder<Controller>(  
76 - init: Controller(),  
77 - builder: null,  
78 - ),  
79 - throwsAssertionError,  
80 - );  
81 - },  
82 - ); 71 + // testWidgets(
  72 + // "MixinBuilder with build null",
  73 + // (test) async {
  74 + // expect(
  75 + // () => GetBuilder<Controller>(
  76 + // init: Controller(),
  77 + // builder: null,
  78 + // ),
  79 + // throwsAssertionError,
  80 + // );
  81 + // },
  82 + // );
83 } 83 }
84 84
85 class Controller extends GetxController { 85 class Controller extends GetxController {