diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e21defe83..54bbcdb0a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: # https://github.com/marketplace/actions/flutter-action - uses: subosito/flutter-action@v2 with: - flutter-version: "3.19.3" + flutter-version: "3.22.0" channel: "stable" - run: flutter pub get #- run: flutter analyze diff --git a/example_nav2/android/local.properties b/example_nav2/android/local.properties index 79defc581..cebbb54d3 100644 --- a/example_nav2/android/local.properties +++ b/example_nav2/android/local.properties @@ -1,2 +1,2 @@ -sdk.dir=/Users/jonatasborges/Library/Android/sdk -flutter.sdk=/Users/jonatasborges/flutter \ No newline at end of file +sdk.dir=C:\\Users\\anike\\AppData\\Local\\Android\\sdk +flutter.sdk=C:\\flutter \ No newline at end of file diff --git a/lib/get_connect/connect.dart b/lib/get_connect/connect.dart index a952bc166..a39ff5a51 100644 --- a/lib/get_connect/connect.dart +++ b/lib/get_connect/connect.dart @@ -316,17 +316,20 @@ class GetConnect extends GetConnectInterface { return GraphQLResponse( graphQLErrors: listError .map((e) => GraphQLError( - code: (e['extensions'] != null ? e['extensions']['code'] ?? '' : '').toString(), + code: (e['extensions'] != null + ? e['extensions']['code'] ?? '' + : '') + .toString(), message: (e['message'] ?? '').toString(), )) .toList()); } return GraphQLResponse.fromResponse(res); - } on Exception catch (_) { + } on Exception catch (err) { return GraphQLResponse(graphQLErrors: [ GraphQLError( code: null, - message: _.toString(), + message: err.toString(), ) ]); } @@ -357,11 +360,11 @@ class GetConnect extends GetConnectInterface { .toList()); } return GraphQLResponse.fromResponse(res); - } on Exception catch (_) { + } on Exception catch (err) { return GraphQLResponse(graphQLErrors: [ GraphQLError( code: null, - message: _.toString(), + message: err.toString(), ) ]); } diff --git a/lib/get_connect/http/src/response/response.dart b/lib/get_connect/http/src/response/response.dart index 66a3265a7..f0f9845c1 100644 --- a/lib/get_connect/http/src/response/response.dart +++ b/lib/get_connect/http/src/response/response.dart @@ -8,7 +8,7 @@ import '../status/http_status.dart'; class GraphQLResponse extends Response { final List? graphQLErrors; - GraphQLResponse({T? body, this.graphQLErrors}) : super(body: body); + GraphQLResponse({super.body, this.graphQLErrors}); GraphQLResponse.fromResponse(Response res) : graphQLErrors = null, diff --git a/lib/get_connect/sockets/sockets.dart b/lib/get_connect/sockets/sockets.dart index faf985562..5dcbe6aa3 100644 --- a/lib/get_connect/sockets/sockets.dart +++ b/lib/get_connect/sockets/sockets.dart @@ -3,7 +3,5 @@ import 'src/sockets_stub.dart' if (dart.library.io) 'src/sockets_io.dart'; class GetSocket extends BaseWebSocket { - GetSocket(String url, - {Duration ping = const Duration(seconds: 5), bool allowSelfSigned = true}) - : super(url, ping: ping, allowSelfSigned: allowSelfSigned); + GetSocket(super.url, {super.ping, super.allowSelfSigned}); } diff --git a/lib/get_navigation/src/bottomsheet/bottomsheet.dart b/lib/get_navigation/src/bottomsheet/bottomsheet.dart index 25c29f9bb..b1f9357c7 100644 --- a/lib/get_navigation/src/bottomsheet/bottomsheet.dart +++ b/lib/get_navigation/src/bottomsheet/bottomsheet.dart @@ -18,11 +18,11 @@ class GetModalBottomSheetRoute extends PopupRoute { this.isDismissible = true, this.enableDrag = true, required this.isScrollControlled, - RouteSettings? settings, + super.settings, this.enterBottomSheetDuration = const Duration(milliseconds: 250), this.exitBottomSheetDuration = const Duration(milliseconds: 200), this.curve, - }) : super(settings: settings) { + }) { RouterReportManager.instance.reportCurrentRoute(this); } final bool? isPersistent; @@ -115,7 +115,7 @@ class GetModalBottomSheetRoute extends PopupRoute { class _GetModalBottomSheet extends StatefulWidget { const _GetModalBottomSheet({ - Key? key, + super.key, this.route, this.backgroundColor, this.elevation, @@ -124,7 +124,7 @@ class _GetModalBottomSheet extends StatefulWidget { this.isScrollControlled = false, this.enableDrag = true, this.isPersistent = false, - }) : super(key: key); + }); final bool isPersistent; final GetModalBottomSheetRoute? route; final bool isScrollControlled; @@ -214,7 +214,7 @@ class _GetModalBottomSheetState extends State<_GetModalBottomSheet> { class _GetPerModalBottomSheet extends StatefulWidget { const _GetPerModalBottomSheet({ - Key? key, + super.key, this.route, this.isPersistent, this.backgroundColor, @@ -223,7 +223,7 @@ class _GetPerModalBottomSheet extends StatefulWidget { this.clipBehavior, this.isScrollControlled = false, this.enableDrag = true, - }) : super(key: key); + }); final bool? isPersistent; final GetModalBottomSheetRoute? route; final bool isScrollControlled; diff --git a/lib/get_navigation/src/dialog/dialog_route.dart b/lib/get_navigation/src/dialog/dialog_route.dart index 4e32b95de..1c8be4e98 100644 --- a/lib/get_navigation/src/dialog/dialog_route.dart +++ b/lib/get_navigation/src/dialog/dialog_route.dart @@ -10,14 +10,13 @@ class GetDialogRoute extends PopupRoute { Color barrierColor = const Color(0x80000000), Duration transitionDuration = const Duration(milliseconds: 200), RouteTransitionsBuilder? transitionBuilder, - RouteSettings? settings, + super.settings, }) : widget = pageBuilder, _barrierDismissible = barrierDismissible, _barrierLabel = barrierLabel, _barrierColor = barrierColor, _transitionDuration = transitionDuration, - _transitionBuilder = transitionBuilder, - super(settings: settings) { + _transitionBuilder = transitionBuilder { RouterReportManager.instance.reportCurrentRoute(this); } @@ -68,6 +67,6 @@ class GetDialogRoute extends PopupRoute { ), child: child); } // Some default transition - return _transitionBuilder!(context, animation, secondaryAnimation, child); + return _transitionBuilder(context, animation, secondaryAnimation, child); } } diff --git a/lib/get_navigation/src/extension_navigation.dart b/lib/get_navigation/src/extension_navigation.dart index cac280640..f8beca29d 100644 --- a/lib/get_navigation/src/extension_navigation.dart +++ b/lib/get_navigation/src/extension_navigation.dart @@ -171,7 +171,7 @@ extension ExtensionDialog on GetInterface { List? actions, // onWillPop Scope - WillPopCallback? onWillPop, + PopInvokedCallback? onWillPop, // the navigator used to push the dialog GlobalKey? navigatorKey, @@ -225,7 +225,7 @@ extension ExtensionDialog on GetInterface { child: Text( textConfirm ?? "Ok", style: TextStyle( - color: confirmTextColor ?? theme.colorScheme.background), + color: confirmTextColor ?? theme.colorScheme.surface), ), onPressed: () { onConfirm?.call(); @@ -267,8 +267,8 @@ extension ExtensionDialog on GetInterface { return dialog( onWillPop != null - ? WillPopScope( - onWillPop: onWillPop, + ? PopScope( + onPopInvoked: onWillPop, child: baseAlertDialog, ) : baseAlertDialog, @@ -1283,7 +1283,7 @@ extension GetNavigationExt on GetInterface { /// Check if dark mode theme is enable on platform on android Q+ bool get isPlatformDarkMode => - (ui.window.platformBrightness == Brightness.dark); + (ui.PlatformDispatcher.instance.platformBrightness == Brightness.dark); /// give access to Theme.of(context).iconTheme.color Color? get iconColor => theme.iconTheme.color; diff --git a/lib/get_navigation/src/root/get_cupertino_app.dart b/lib/get_navigation/src/root/get_cupertino_app.dart index 8fb3e7477..cee98b97b 100644 --- a/lib/get_navigation/src/root/get_cupertino_app.dart +++ b/lib/get_navigation/src/root/get_cupertino_app.dart @@ -67,7 +67,7 @@ class GetCupertinoApp extends StatelessWidget { final ScrollBehavior? scrollBehavior; const GetCupertinoApp({ - Key? key, + super.key, this.theme, this.navigatorKey, this.home, @@ -124,11 +124,10 @@ class GetCupertinoApp extends StatelessWidget { backButtonDispatcher = null, routeInformationParser = null, routerDelegate = null, - routerConfig = null, - super(key: key); + routerConfig = null; const GetCupertinoApp.router({ - Key? key, + super.key, this.theme, this.routeInformationProvider, this.routeInformationParser, @@ -183,8 +182,7 @@ class GetCupertinoApp extends StatelessWidget { onGenerateInitialRoutes = null, onUnknownRoute = null, routes = null, - initialRoute = null, - super(key: key); + initialRoute = null; @override Widget build(BuildContext context) { diff --git a/lib/get_navigation/src/root/get_material_app.dart b/lib/get_navigation/src/root/get_material_app.dart index 00276f2f7..a321ac070 100644 --- a/lib/get_navigation/src/root/get_material_app.dart +++ b/lib/get_navigation/src/root/get_material_app.dart @@ -68,7 +68,7 @@ class GetMaterialApp extends StatelessWidget { final bool useInheritedMediaQuery; const GetMaterialApp({ - Key? key, + super.key, this.navigatorKey, this.scaffoldMessengerKey, this.home, @@ -128,11 +128,10 @@ class GetMaterialApp extends StatelessWidget { backButtonDispatcher = null, routeInformationParser = null, routerDelegate = null, - routerConfig = null, - super(key: key); + routerConfig = null; const GetMaterialApp.router({ - Key? key, + super.key, this.routeInformationProvider, this.scaffoldMessengerKey, this.routeInformationParser, @@ -190,8 +189,7 @@ class GetMaterialApp extends StatelessWidget { onGenerateInitialRoutes = null, onUnknownRoute = null, routes = null, - initialRoute = null, - super(key: key); + initialRoute = null; @override Widget build(BuildContext context) { diff --git a/lib/get_navigation/src/root/get_root.dart b/lib/get_navigation/src/root/get_root.dart index eab7a6983..1789a00ae 100644 --- a/lib/get_navigation/src/root/get_root.dart +++ b/lib/get_navigation/src/root/get_root.dart @@ -278,10 +278,10 @@ class ConfigData { class GetRoot extends StatefulWidget { const GetRoot({ - Key? key, + super.key, required this.config, required this.child, - }) : super(key: key); + }); final ConfigData config; final Widget child; @override diff --git a/lib/get_navigation/src/routes/default_route.dart b/lib/get_navigation/src/routes/default_route.dart index a4470cc8e..aebaa7882 100644 --- a/lib/get_navigation/src/routes/default_route.dart +++ b/lib/get_navigation/src/routes/default_route.dart @@ -39,7 +39,7 @@ class GetPageRoute extends PageRoute /// The [builder], [maintainState], and [fullscreenDialog] arguments must not /// be null. GetPageRoute({ - RouteSettings? settings, + super.settings, this.transitionDuration = const Duration(milliseconds: 300), this.reverseTransitionDuration = const Duration(milliseconds: 300), this.opaque = true, @@ -61,13 +61,9 @@ class GetPageRoute extends PageRoute this.showCupertinoParallax = true, this.barrierLabel, this.maintainState = true, - bool fullscreenDialog = false, + super.fullscreenDialog, this.middlewares, - }) : bindings = (binding == null) ? bindings : [...bindings, binding], - super( - settings: settings, - fullscreenDialog: fullscreenDialog, - ); + }) : bindings = (binding == null) ? bindings : [...bindings, binding]; @override final Duration transitionDuration; diff --git a/lib/get_navigation/src/routes/get_navigator.dart b/lib/get_navigation/src/routes/get_navigator.dart index a907c4e69..53cb02dba 100644 --- a/lib/get_navigation/src/routes/get_navigator.dart +++ b/lib/get_navigation/src/routes/get_navigator.dart @@ -4,18 +4,16 @@ import '../../../get.dart'; class GetNavigator extends Navigator { GetNavigator.onGenerateRoute({ - GlobalKey? key, + GlobalKey? super.key, bool Function(Route, dynamic)? onPopPage, - required List pages, + required List super.pages, List? observers, - bool reportsRouteUpdateToEngine = false, + super.reportsRouteUpdateToEngine, TransitionDelegate? transitionDelegate, - String? initialRoute, - String? restorationScopeId, + super.initialRoute, + super.restorationScopeId, }) : super( //keys should be optional - key: key, - initialRoute: initialRoute, onPopPage: onPopPage ?? (route, result) { final didPop = route.didPop(result); @@ -36,9 +34,6 @@ class GetNavigator extends Navigator { } return null; }, - reportsRouteUpdateToEngine: reportsRouteUpdateToEngine, - restorationScopeId: restorationScopeId, - pages: pages, observers: [ // GetObserver(), ...?observers, @@ -48,18 +43,16 @@ class GetNavigator extends Navigator { ); GetNavigator({ - Key? key, + super.key, bool Function(Route, dynamic)? onPopPage, - required List pages, + required List super.pages, List? observers, - bool reportsRouteUpdateToEngine = false, + super.reportsRouteUpdateToEngine, TransitionDelegate? transitionDelegate, - String? initialRoute, - String? restorationScopeId, + super.initialRoute, + super.restorationScopeId, }) : super( //keys should be optional - key: key, - initialRoute: initialRoute, onPopPage: onPopPage ?? (route, result) { final didPop = route.didPop(result); @@ -68,9 +61,6 @@ class GetNavigator extends Navigator { } return true; }, - reportsRouteUpdateToEngine: reportsRouteUpdateToEngine, - restorationScopeId: restorationScopeId, - pages: pages, observers: [ // GetObserver(null, Get.routing), HeroController(), diff --git a/lib/get_navigation/src/routes/get_transition_mixin.dart b/lib/get_navigation/src/routes/get_transition_mixin.dart index 89cb9d72f..2d1a909df 100644 --- a/lib/get_navigation/src/routes/get_transition_mixin.dart +++ b/lib/get_navigation/src/routes/get_transition_mixin.dart @@ -23,14 +23,14 @@ const int _kMaxPageBackAnimationTime = 300; // Milliseconds. class GetBackGestureDetector extends StatefulWidget { const GetBackGestureDetector({ - Key? key, + super.key, required this.limitedSwipe, required this.gestureWidth, required this.initialOffset, required this.popGestureEnable, required this.onStartPopGesture, required this.child, - }) : super(key: key); + }); final bool limitedSwipe; final double gestureWidth; @@ -370,8 +370,7 @@ Cannot read the previousTitle for a route that has not yet been installed''', // In the middle of a back gesture drag, let the transition be linear to // match finger motions. final route = rawRoute as GetPageRoute; - final linearTransition = - CupertinoRouteTransitionMixin.isPopGestureInProgress(route); + final linearTransition = route.popGestureInProgress; final finalCurve = route.curve ?? Get.defaultTransitionCurve; final hasCurve = route.curve != null; if (route.fullscreenDialog && route.transition == null) { @@ -777,9 +776,6 @@ Cannot read the previousTitle for a route that has not yet been installed''', // would be really confusing (or would skip internal routes), // so disallow it. if (route.willHandlePopInternally) return false; - // If attempts to dismiss this route might be vetoed such as in a page - // with forms, then do not allow the user to dismiss the route with a swipe. - if (route.hasScopedWillPopCallback) return false; // support [PopScope] if (route.popDisposition == RoutePopDisposition.doNotPop) return false; // Fullscreen dialogs aren't dismissible by back swipe. @@ -826,8 +822,8 @@ class _DirectionalityDragGestureRecognizer required this.isLTR, required this.popGestureEnable, required this.hasbackGestureController, - Object? debugOwner, - }) : super(debugOwner: debugOwner); + super.debugOwner, + }); @override void handleEvent(PointerEvent event) { diff --git a/lib/get_navigation/src/routes/modules.dart b/lib/get_navigation/src/routes/modules.dart index 522a6aac1..b278d5942 100644 --- a/lib/get_navigation/src/routes/modules.dart +++ b/lib/get_navigation/src/routes/modules.dart @@ -57,7 +57,7 @@ class Dependencies { } abstract class Module extends StatefulWidget { - const Module({Key? key}) : super(key: key); + const Module({super.key}); Widget view(BuildContext context); diff --git a/lib/get_navigation/src/routes/route_report.dart b/lib/get_navigation/src/routes/route_report.dart index c0007929a..090ae1511 100644 --- a/lib/get_navigation/src/routes/route_report.dart +++ b/lib/get_navigation/src/routes/route_report.dart @@ -4,7 +4,7 @@ import '../router_report.dart'; import 'default_route.dart'; class RouteReport extends StatefulWidget { - const RouteReport({Key? key, required this.builder}) : super(key: key); + const RouteReport({super.key, required this.builder}); final WidgetBuilder builder; @override diff --git a/lib/get_navigation/src/routes/router_outlet.dart b/lib/get_navigation/src/routes/router_outlet.dart index f0fa96a2c..6432826c5 100644 --- a/lib/get_navigation/src/routes/router_outlet.dart +++ b/lib/get_navigation/src/routes/router_outlet.dart @@ -114,7 +114,7 @@ class GetRouterOutlet extends RouterOutlet { super.key, Widget Function(GetDelegate delegate)? emptyWidget, GetPage Function(GetDelegate delegate)? emptyPage, - required Iterable Function(RouteDecoder currentNavStack) pickPages, + required super.pickPages, bool Function(Route, dynamic)? onPopPage, String? restorationScopeId, GlobalKey? navigatorKey, @@ -147,19 +147,15 @@ class GetRouterOutlet extends RouterOutlet { } return (emptyWidget?.call(rDelegate) ?? const SizedBox.shrink()); }, - pickPages: pickPages, delegate: delegate ?? Get.rootController.rootDelegate, ); GetRouterOutlet.builder({ super.key, - required Widget Function( - BuildContext context, - ) builder, + required super.builder, String? route, GetDelegate? routerDelegate, }) : super.builder( - builder: builder, delegate: routerDelegate ?? (route != null ? Get.nestedKey(route) @@ -213,10 +209,10 @@ typedef NavigatorItemBuilderBuilder = Widget Function( class IndexedRouteBuilder extends StatelessWidget { const IndexedRouteBuilder({ - Key? key, + super.key, required this.builder, required this.routes, - }) : super(key: key); + }); final List routes; final NavigatorItemBuilderBuilder builder; @@ -269,8 +265,8 @@ mixin RouterListenerMixin on State { class RouterListenerInherited extends InheritedWidget { const RouterListenerInherited({ super.key, - required Widget child, - }) : super(child: child); + required super.child, + }); static RouterListenerInherited? of(BuildContext context) { return context @@ -285,9 +281,9 @@ class RouterListenerInherited extends InheritedWidget { class RouterListener extends StatefulWidget { const RouterListener({ - Key? key, + super.key, required this.builder, - }) : super(key: key); + }); final WidgetBuilder builder; @override @@ -303,7 +299,7 @@ class RouteListenerState extends State } class BackButtonCallback extends StatefulWidget { - const BackButtonCallback({Key? key, required this.builder}) : super(key: key); + const BackButtonCallback({super.key, required this.builder}); final WidgetBuilder builder; @override diff --git a/lib/get_navigation/src/snackbar/snackbar.dart b/lib/get_navigation/src/snackbar/snackbar.dart index 29973476f..9db02265a 100644 --- a/lib/get_navigation/src/snackbar/snackbar.dart +++ b/lib/get_navigation/src/snackbar/snackbar.dart @@ -173,7 +173,7 @@ class GetSnackBar extends StatefulWidget { final Form? userInputForm; const GetSnackBar({ - Key? key, + super.key, this.title, this.message, this.titleText, @@ -211,7 +211,7 @@ class GetSnackBar extends StatefulWidget { this.userInputForm, this.snackbarStatus, this.hitTestBehavior, - }) : super(key: key); + }); @override State createState() => GetSnackBarState(); diff --git a/lib/get_rx/src/rx_stream/mini_stream.dart b/lib/get_rx/src/rx_stream/mini_stream.dart index e08e4632b..838949373 100644 --- a/lib/get_rx/src/rx_stream/mini_stream.dart +++ b/lib/get_rx/src/rx_stream/mini_stream.dart @@ -1,4 +1,4 @@ -part of rx_stream; +part of 'rx_stream.dart'; class Node { T? data; diff --git a/lib/get_rx/src/rx_types/rx_core/rx_impl.dart b/lib/get_rx/src/rx_types/rx_core/rx_impl.dart index 45bc03cfa..c879e234e 100644 --- a/lib/get_rx/src/rx_types/rx_core/rx_impl.dart +++ b/lib/get_rx/src/rx_types/rx_core/rx_impl.dart @@ -1,4 +1,4 @@ -part of rx_types; +part of '../rx_types.dart'; /// global object that registers against `GetX` and `Obx`, and allows the /// reactivity @@ -139,7 +139,7 @@ mixin RxObjectMixin on GetListenable { /// Base Rx class that manages all the stream logic for any Type. abstract class _RxImpl extends GetListenable with RxObjectMixin { - _RxImpl(T initial) : super(initial); + _RxImpl(super.initial); void addError(Object error, [StackTrace? stackTrace]) { subject.addError(error, stackTrace); @@ -209,7 +209,7 @@ abstract class _RxImpl extends GetListenable with RxObjectMixin { } class RxBool extends Rx { - RxBool(bool initial) : super(initial); + RxBool(super.initial); @override String toString() { return value ? "true" : "false"; @@ -217,7 +217,7 @@ class RxBool extends Rx { } class RxnBool extends Rx { - RxnBool([bool? initial]) : super(initial); + RxnBool([super.initial]); @override String toString() { return "$value"; @@ -282,7 +282,7 @@ extension RxnBoolExt on Rx { /// For example, any custom "Model" class, like User().obs will use `Rx` as /// wrapper. class Rx extends _RxImpl { - Rx(T initial) : super(initial); + Rx(super.initial); @override dynamic toJson() { @@ -295,7 +295,7 @@ class Rx extends _RxImpl { } class Rxn extends Rx { - Rxn([T? initial]) : super(initial); + Rxn([super.initial]); @override dynamic toJson() { diff --git a/lib/get_rx/src/rx_types/rx_core/rx_interface.dart b/lib/get_rx/src/rx_types/rx_core/rx_interface.dart index 8db50ef16..7c838eb58 100644 --- a/lib/get_rx/src/rx_types/rx_core/rx_interface.dart +++ b/lib/get_rx/src/rx_types/rx_core/rx_interface.dart @@ -1,4 +1,4 @@ -part of rx_types; +part of '../rx_types.dart'; /// This class is the foundation for all reactive (Rx) classes that makes Get /// so powerful. diff --git a/lib/get_rx/src/rx_types/rx_core/rx_num.dart b/lib/get_rx/src/rx_types/rx_core/rx_num.dart index 741eb0847..5a1680ad2 100644 --- a/lib/get_rx/src/rx_types/rx_core/rx_num.dart +++ b/lib/get_rx/src/rx_types/rx_core/rx_num.dart @@ -1,4 +1,4 @@ -part of rx_types; +part of '../rx_types.dart'; extension RxNumExt on Rx { /// Multiplication operator. @@ -572,7 +572,7 @@ extension RxnNumExt on Rx { } class RxNum extends Rx { - RxNum(num initial) : super(initial); + RxNum(super.initial); num operator +(num other) { value += other; @@ -587,7 +587,7 @@ class RxNum extends Rx { } class RxnNum extends Rx { - RxnNum([num? initial]) : super(initial); + RxnNum([super.initial]); num? operator +(num other) { if (value != null) { @@ -857,15 +857,15 @@ extension RxnDoubleExt on Rx { } class RxDouble extends Rx { - RxDouble(double initial) : super(initial); + RxDouble(super.initial); } class RxnDouble extends Rx { - RxnDouble([double? initial]) : super(initial); + RxnDouble([super.initial]); } class RxInt extends Rx { - RxInt(int initial) : super(initial); + RxInt(super.initial); /// Addition operator. RxInt operator +(int other) { @@ -881,7 +881,7 @@ class RxInt extends Rx { } class RxnInt extends Rx { - RxnInt([int? initial]) : super(initial); + RxnInt([super.initial]); /// Addition operator. RxnInt operator +(int other) { diff --git a/lib/get_rx/src/rx_types/rx_core/rx_string.dart b/lib/get_rx/src/rx_types/rx_core/rx_string.dart index def5aa036..5a42c278c 100644 --- a/lib/get_rx/src/rx_types/rx_core/rx_string.dart +++ b/lib/get_rx/src/rx_types/rx_core/rx_string.dart @@ -1,4 +1,4 @@ -part of rx_types; +part of '../rx_types.dart'; extension RxStringExt on Rx { String operator +(String val) => value + val; @@ -250,7 +250,7 @@ extension RxnStringExt on Rx { /// Rx class for `String` Type. class RxString extends Rx implements Comparable, Pattern { - RxString(String initial) : super(initial); + RxString(super.initial); @override Iterable allMatches(String string, [int start = 0]) { @@ -270,7 +270,7 @@ class RxString extends Rx implements Comparable, Pattern { /// Rx class for `String` Type. class RxnString extends Rx implements Comparable, Pattern { - RxnString([String? initial]) : super(initial); + RxnString([super.initial]); @override Iterable allMatches(String string, [int start = 0]) { diff --git a/lib/get_rx/src/rx_types/rx_iterables/rx_list.dart b/lib/get_rx/src/rx_types/rx_iterables/rx_list.dart index af6e65b10..7408c440f 100644 --- a/lib/get_rx/src/rx_types/rx_iterables/rx_list.dart +++ b/lib/get_rx/src/rx_types/rx_iterables/rx_list.dart @@ -1,9 +1,9 @@ -part of rx_types; +part of '../rx_types.dart'; /// Create a list similar to `List` class RxList extends GetListenable> with ListMixin, RxObjectMixin> { - RxList([List initial = const []]) : super(initial); + RxList([super.initial = const []]); factory RxList.filled(int length, E fill, {bool growable = false}) { return RxList(List.filled(length, fill, growable: growable)); diff --git a/lib/get_rx/src/rx_types/rx_iterables/rx_map.dart b/lib/get_rx/src/rx_types/rx_iterables/rx_map.dart index 2ada59174..97a695056 100644 --- a/lib/get_rx/src/rx_types/rx_iterables/rx_map.dart +++ b/lib/get_rx/src/rx_types/rx_iterables/rx_map.dart @@ -1,8 +1,8 @@ -part of rx_types; +part of '../rx_types.dart'; class RxMap extends GetListenable> with MapMixin, RxObjectMixin> { - RxMap([Map initial = const {}]) : super(initial); + RxMap([super.initial = const {}]); factory RxMap.from(Map other) { return RxMap(Map.from(other)); diff --git a/lib/get_rx/src/rx_types/rx_iterables/rx_set.dart b/lib/get_rx/src/rx_types/rx_iterables/rx_set.dart index 62cebb4e2..dc4e2431b 100644 --- a/lib/get_rx/src/rx_types/rx_iterables/rx_set.dart +++ b/lib/get_rx/src/rx_types/rx_iterables/rx_set.dart @@ -1,8 +1,8 @@ -part of rx_types; +part of '../rx_types.dart'; class RxSet extends GetListenable> with SetMixin, RxObjectMixin> { - RxSet([Set initial = const {}]) : super(initial); + RxSet([super.initial = const {}]); /// Special override to push() element(s) in a reactive way /// inside the List, diff --git a/lib/get_state_manager/src/rx_flutter/rx_notifier.dart b/lib/get_state_manager/src/rx_flutter/rx_notifier.dart index 928111454..c8f2a349c 100644 --- a/lib/get_state_manager/src/rx_flutter/rx_notifier.dart +++ b/lib/get_state_manager/src/rx_flutter/rx_notifier.dart @@ -211,7 +211,7 @@ class Value extends ListNotifier /// GetNotifier has a native status and state implementation, with the /// Get Lifecycle abstract class GetNotifier extends Value with GetLifeCycleMixin { - GetNotifier(T initial) : super(initial); + GetNotifier(super.initial); } extension StateExt on StateMixin { diff --git a/lib/get_state_manager/src/rx_flutter/rx_obx_widget.dart b/lib/get_state_manager/src/rx_flutter/rx_obx_widget.dart index ed553a598..f701829c7 100644 --- a/lib/get_state_manager/src/rx_flutter/rx_obx_widget.dart +++ b/lib/get_state_manager/src/rx_flutter/rx_obx_widget.dart @@ -11,7 +11,7 @@ typedef WidgetCallback = Widget Function(); /// - [Obx] /// - [ObxValue] abstract class ObxWidget extends ObxStatelessWidget { - const ObxWidget({Key? key}) : super(key: key); + const ObxWidget({super.key}); } /// The simplest reactive widget in GetX. @@ -47,7 +47,7 @@ class ObxValue extends ObxWidget { final Widget Function(T) builder; final T data; - const ObxValue(this.builder, this.data, {Key? key}) : super(key: key); + const ObxValue(this.builder, this.data, {super.key}); @override Widget build(BuildContext context) => builder(data); diff --git a/lib/get_state_manager/src/rx_flutter/rx_ticket_provider_mixin.dart b/lib/get_state_manager/src/rx_flutter/rx_ticket_provider_mixin.dart index 9f94c2d16..33696cfa1 100644 --- a/lib/get_state_manager/src/rx_flutter/rx_ticket_provider_mixin.dart +++ b/lib/get_state_manager/src/rx_flutter/rx_ticket_provider_mixin.dart @@ -165,8 +165,7 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider { } class _WidgetTicker extends Ticker { - _WidgetTicker(TickerCallback onTick, this._creator, {String? debugLabel}) - : super(onTick, debugLabel: debugLabel); + _WidgetTicker(super.onTick, this._creator, {super.debugLabel}); final GetTickerProviderStateMixin _creator; diff --git a/lib/get_state_manager/src/simple/get_responsive.dart b/lib/get_state_manager/src/simple/get_responsive.dart index 5feec069d..197e09e27 100644 --- a/lib/get_state_manager/src/simple/get_responsive.dart +++ b/lib/get_state_manager/src/simple/get_responsive.dart @@ -62,9 +62,8 @@ class GetResponsiveView extends GetView with GetResponsiveMixin { GetResponsiveView({ this.alwaysUseBuilder = false, ResponsiveScreenSettings settings = const ResponsiveScreenSettings(), - Key? key, - }) : screen = ResponsiveScreen(settings), - super(key: key); + super.key, + }) : screen = ResponsiveScreen(settings); } class GetResponsiveWidget extends GetWidget @@ -78,9 +77,8 @@ class GetResponsiveWidget extends GetWidget GetResponsiveWidget({ this.alwaysUseBuilder = false, ResponsiveScreenSettings settings = const ResponsiveScreenSettings(), - Key? key, - }) : screen = ResponsiveScreen(settings), - super(key: key); + super.key, + }) : screen = ResponsiveScreen(settings); } class ResponsiveScreenSettings { diff --git a/lib/get_state_manager/src/simple/get_state.dart b/lib/get_state_manager/src/simple/get_state.dart index cdc4fc6ce..354c339db 100644 --- a/lib/get_state_manager/src/simple/get_state.dart +++ b/lib/get_state_manager/src/simple/get_state.dart @@ -47,7 +47,7 @@ class GetBuilder extends StatelessWidget { final T? init; const GetBuilder({ - Key? key, + super.key, this.init, this.global = true, required this.builder, @@ -60,7 +60,7 @@ class GetBuilder extends StatelessWidget { this.id, this.didChangeDependencies, this.didUpdateWidget, - }) : super(key: key); + }); @override Widget build(BuildContext context) { @@ -88,7 +88,7 @@ class GetBuilder extends StatelessWidget { abstract class Bind extends StatelessWidget { const Bind({ - Key? key, + super.key, required this.child, this.init, this.global = true, @@ -101,7 +101,7 @@ abstract class Bind extends StatelessWidget { this.id, this.didChangeDependencies, this.didUpdateWidget, - }) : super(key: key); + }); final InitBuilder? init; @@ -296,7 +296,7 @@ class _FactoryBind extends Bind { final Widget? child; const _FactoryBind({ - Key? key, + super.key, this.child, this.init, this.create, @@ -310,7 +310,7 @@ class _FactoryBind extends Bind { this.id, this.didChangeDependencies, this.didUpdateWidget, - }) : super(key: key, child: child); + }) : super(child: child); @override Bind _copyWithChild(Widget child) { @@ -355,11 +355,10 @@ class Binds extends StatelessWidget { final Widget child; Binds({ - Key? key, + super.key, required this.binds, required this.child, - }) : assert(binds.isNotEmpty), - super(key: key); + }) : assert(binds.isNotEmpty); @override Widget build(BuildContext context) => @@ -372,8 +371,8 @@ class Binder extends InheritedWidget { /// /// The [child] argument is required const Binder({ - Key? key, - required Widget child, + super.key, + required super.child, this.init, this.global = true, this.autoRemove = true, @@ -387,7 +386,7 @@ class Binder extends InheritedWidget { this.didChangeDependencies, this.didUpdateWidget, this.create, - }) : super(key: key, child: child); + }); final InitBuilder? init; final InstanceCreateBuilderCallback? create; @@ -419,7 +418,7 @@ class Binder extends InheritedWidget { /// The BindElement is responsible for injecting dependencies into the widget /// tree so that they can be observed class BindElement extends InheritedElement { - BindElement(Binder widget) : super(widget) { + BindElement(Binder super.widget) { initState(); } diff --git a/lib/get_state_manager/src/simple/get_view.dart b/lib/get_state_manager/src/simple/get_view.dart index 8399c024f..8e50da26b 100644 --- a/lib/get_state_manager/src/simple/get_view.dart +++ b/lib/get_state_manager/src/simple/get_view.dart @@ -32,7 +32,7 @@ import 'get_widget_cache.dart'; /// } ///`` abstract class GetView extends StatelessWidget { - const GetView({Key? key}) : super(key: key); + const GetView({super.key}); final String? tag = null; @@ -49,7 +49,7 @@ abstract class GetView extends StatelessWidget { /// GetWidget will have your own controller, and will be call events as `onInit` /// and `onClose` when the controller get in/get out on memory. abstract class GetWidget extends GetWidgetCache { - const GetWidget({Key? key}) : super(key: key); + const GetWidget({super.key}); @protected final String? tag = null; diff --git a/lib/get_state_manager/src/simple/get_widget_cache.dart b/lib/get_state_manager/src/simple/get_widget_cache.dart index 9d60c1711..2e0ce75db 100644 --- a/lib/get_state_manager/src/simple/get_widget_cache.dart +++ b/lib/get_state_manager/src/simple/get_widget_cache.dart @@ -1,7 +1,7 @@ import 'package:flutter/widgets.dart'; abstract class GetWidgetCache extends Widget { - const GetWidgetCache({Key? key}) : super(key: key); + const GetWidgetCache({super.key}); @override GetWidgetCacheElement createElement() => GetWidgetCacheElement(this); diff --git a/lib/get_state_manager/src/simple/mixin_builder.dart b/lib/get_state_manager/src/simple/mixin_builder.dart index adfcf4ba7..8f44257a8 100644 --- a/lib/get_state_manager/src/simple/mixin_builder.dart +++ b/lib/get_state_manager/src/simple/mixin_builder.dart @@ -18,7 +18,7 @@ class MixinBuilder extends StatelessWidget { final T? init; const MixinBuilder({ - Key? key, + super.key, this.init, this.global = true, required this.builder, @@ -28,7 +28,7 @@ class MixinBuilder extends StatelessWidget { this.id, this.didChangeDependencies, this.didUpdateWidget, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/lib/get_state_manager/src/simple/simple_builder.dart b/lib/get_state_manager/src/simple/simple_builder.dart index aed1f488f..094a3e4aa 100644 --- a/lib/get_state_manager/src/simple/simple_builder.dart +++ b/lib/get_state_manager/src/simple/simple_builder.dart @@ -30,12 +30,12 @@ class ValueBuilder extends StatefulWidget { final void Function(T)? onUpdate; const ValueBuilder({ - Key? key, + super.key, required this.initialValue, this.onDispose, this.onUpdate, required this.builder, - }) : super(key: key); + }); @override ValueBuilderState createState() => ValueBuilderState(); @@ -79,7 +79,7 @@ class ObxElement = StatelessElement with StatelessObserverComponent; class Observer extends ObxStatelessWidget { final WidgetBuilder builder; - const Observer({Key? key, required this.builder}) : super(key: key); + const Observer({super.key, required this.builder}); @override Widget build(BuildContext context) => builder(context); @@ -88,7 +88,7 @@ class Observer extends ObxStatelessWidget { /// A StatelessWidget than can listen reactive changes. abstract class ObxStatelessWidget extends StatelessWidget { /// Initializes [key] for subclasses. - const ObxStatelessWidget({Key? key}) : super(key: key); + const ObxStatelessWidget({super.key}); @override StatelessElement createElement() => ObxElement(this); } diff --git a/lib/get_utils/src/equality/equality.dart b/lib/get_utils/src/equality/equality.dart index 3c478d22f..be5edfba8 100644 --- a/lib/get_utils/src/equality/equality.dart +++ b/lib/get_utils/src/equality/equality.dart @@ -273,9 +273,7 @@ class IterableEquality implements IEquality> { /// and the elements of one set can be paired with the elements /// of the other set, so that each pair are equal. class SetEquality extends _UnorderedEquality> { - const SetEquality( - [IEquality elementEquality = const DefaultEquality()]) - : super(elementEquality); + const SetEquality([super.elementEquality = const DefaultEquality()]); @override bool isValidKey(Object? o) => o is Set; @@ -332,8 +330,7 @@ abstract class _UnorderedEquality> /// of the other iterable, so that each pair are equal. class UnorderedIterableEquality extends _UnorderedEquality> { const UnorderedIterableEquality( - [IEquality elementEquality = const DefaultEquality()]) - : super(elementEquality); + [super.elementEquality = const DefaultEquality()]); @override bool isValidKey(Object? o) => o is Iterable; diff --git a/lib/get_utils/src/extensions/context_extensions.dart b/lib/get_utils/src/extensions/context_extensions.dart index f4ad5092b..74cc53dc8 100644 --- a/lib/get_utils/src/extensions/context_extensions.dart +++ b/lib/get_utils/src/extensions/context_extensions.dart @@ -90,7 +90,7 @@ extension ContextExt on BuildContext { double get devicePixelRatio => MediaQuery.devicePixelRatioOf(this); /// similar to [MediaQuery.textScaleFactorOf(context)] - double get textScaleFactor => MediaQuery.textScaleFactorOf(this); + TextScaler get textScaleFactor => MediaQuery.textScalerOf(this); /// get the shortestSide from screen double get mediaQueryShortestSide => mediaQuerySize.shortestSide; diff --git a/lib/get_utils/src/widgets/otimized_listview.dart b/lib/get_utils/src/widgets/optimized_listview.dart similarity index 90% rename from lib/get_utils/src/widgets/otimized_listview.dart rename to lib/get_utils/src/widgets/optimized_listview.dart index 5692b1975..3e52b9e45 100644 --- a/lib/get_utils/src/widgets/otimized_listview.dart +++ b/lib/get_utils/src/widgets/optimized_listview.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -class OtimizedListView extends StatelessWidget { +class OptimizedListView extends StatelessWidget { final List list; final Axis scrollDirection; final bool reverse; @@ -11,8 +11,8 @@ class OtimizedListView extends StatelessWidget { final Widget onEmpty; final int length; final Widget Function(BuildContext context, ValueKey key, T item) builder; - const OtimizedListView({ - Key? key, + const OptimizedListView({ + super.key, required this.list, required this.builder, this.scrollDirection = Axis.vertical, @@ -22,8 +22,7 @@ class OtimizedListView extends StatelessWidget { this.physics, this.onEmpty = const SizedBox.shrink(), this.shrinkWrap = false, - }) : length = list.length, - super(key: key); + }) : length = list.length; @override Widget build(BuildContext context) { if (list.isEmpty) return onEmpty; diff --git a/pubspec.yaml b/pubspec.yaml index 69a520939..c83f23bb5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,17 +4,18 @@ version: 5.0.0-release-candidate-5 homepage: https://github.com/jonataslaw/getx environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" dependencies: flutter: sdk: flutter flutter_web_plugins: sdk: flutter - web: any + web: ">=0.4.0 <0.6.0" dev_dependencies: - flutter_lints: ^2.0.3 + flutter_lints: ^4.0.0 flutter_test: sdk: flutter diff --git a/test/navigation/dialog_test.dart b/test/navigation/dialog_test.dart index 849402a87..bf2db4cd9 100644 --- a/test/navigation/dialog_test.dart +++ b/test/navigation/dialog_test.dart @@ -57,7 +57,7 @@ void main() { } class YourDialogWidget extends StatelessWidget { - const YourDialogWidget({Key? key}) : super(key: key); + const YourDialogWidget({super.key}); @override Widget build(BuildContext context) { diff --git a/test/navigation/get_main_test.dart b/test/navigation/get_main_test.dart index 56d13bb8e..240ae5a4d 100644 --- a/test/navigation/get_main_test.dart +++ b/test/navigation/get_main_test.dart @@ -570,7 +570,7 @@ void main() { } class FirstScreen extends StatelessWidget { - const FirstScreen({Key? key}) : super(key: key); + const FirstScreen({super.key}); @override Widget build(BuildContext context) { @@ -580,7 +580,7 @@ class FirstScreen extends StatelessWidget { } class SecondScreen extends StatelessWidget { - const SecondScreen({Key? key}) : super(key: key); + const SecondScreen({super.key}); @override Widget build(BuildContext context) { @@ -589,7 +589,7 @@ class SecondScreen extends StatelessWidget { } class ThirdScreen extends StatelessWidget { - const ThirdScreen({Key? key}) : super(key: key); + const ThirdScreen({super.key}); @override Widget build(BuildContext context) { diff --git a/test/navigation/utils/wrapper.dart b/test/navigation/utils/wrapper.dart index 5d9261cdc..20a7e8053 100644 --- a/test/navigation/utils/wrapper.dart +++ b/test/navigation/utils/wrapper.dart @@ -8,12 +8,12 @@ class Wrapper extends StatelessWidget { final Transition? defaultTransition; const Wrapper({ - Key? key, + super.key, this.child, this.namedRoutes, this.initialRoute, this.defaultTransition, - }) : super(key: key); + }); @override Widget build(BuildContext context) { @@ -39,12 +39,12 @@ class WrapperNamed extends StatelessWidget { final Transition? defaultTransition; const WrapperNamed({ - Key? key, + super.key, this.child, this.namedRoutes, this.initialRoute, this.defaultTransition, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/test/rx/rx_workers_test.dart b/test/rx/rx_workers_test.dart index accb40f71..66b2d1ca7 100644 --- a/test/rx/rx_workers_test.dart +++ b/test/rx/rx_workers_test.dart @@ -7,8 +7,8 @@ void main() { test('once', () async { final count = 0.obs; var result = -1; - once(count, (dynamic _) { - result = _ as int; + once(count, (dynamic val) { + result = val as int; }); count.value++; await Future.delayed(Duration.zero); @@ -41,9 +41,9 @@ void main() { test('debounce', () async { final count = 0.obs; int? result = -1; - debounce(count, (dynamic _) { + debounce(count, (dynamic val) { // print(_); - result = _ as int?; + result = val as int?; }, time: const Duration(milliseconds: 100)); count.value++; diff --git a/test/utils/extensions/context_extensions_test.dart b/test/utils/extensions/context_extensions_test.dart index ac7ed85ec..79620a4eb 100644 --- a/test/utils/extensions/context_extensions_test.dart +++ b/test/utils/extensions/context_extensions_test.dart @@ -63,7 +63,7 @@ void main() { var showNavbar = (width > 800); expect(showNavbar, context.showNavbar); - var textScaleFactor = mediaQuery.textScaleFactor; + var textScaleFactor = mediaQuery.textScaler; expect(textScaleFactor, context.textScaleFactor); }); } diff --git a/test/utils/platform_test.dart b/test/utils/platform_test.dart index bb09c5436..3178c7bf9 100644 --- a/test/utils/platform_test.dart +++ b/test/utils/platform_test.dart @@ -1,5 +1,8 @@ @TestOn('vm') +library; + import 'dart:io'; + import 'package:flutter_test/flutter_test.dart'; import 'package:get/get.dart'; diff --git a/test/utils/platform_web_test.dart b/test/utils/platform_web_test.dart index fd1ae0af9..7e6f04bfc 100644 --- a/test/utils/platform_web_test.dart +++ b/test/utils/platform_web_test.dart @@ -1,4 +1,6 @@ @TestOn('browser') +library; + import 'dart:io'; import 'package:flutter_test/flutter_test.dart';