Jonny Borges
Committed by GitHub

Merge pull request #1217 from jonataslaw/null-safety

Null safety
Showing 48 changed files with 1099 additions and 1176 deletions

Too many changes to show.

To preserve performance only 48 of 48+ files are displayed.

  1 +# This file tracks properties of this Flutter project.
  2 +# Used by Flutter tool to assess capabilities and perform upgrades etc.
  3 +#
  4 +# This file should be version controlled and should not be manually edited.
  5 +
  6 +version:
  7 + revision: 60bd88df915880d23877bfc1602e8ddcf4c4dd2a
  8 + channel: stable
  9 +
  10 +project_type: app
  1 +## [4.0.0-nullsafety.2]
  2 +- Added append function to StateMixin. Now is possible track loading, success and error handle of your application with ONE LINE OF CODE. Ex: append(()=> api.getUser);
  3 +
  4 +## [4.0.0-nullsafety.0]
  5 +- Migrate to null-safety
  6 +- Added ScrollMixin to controllers
  7 +- Added loadingMore status to RxStatus
  8 +- Breaking: It is not possible to initialize Rx with null values.
  9 +
1 ## [3.25.6] 10 ## [3.25.6]
2 - Added documentation in French (@kamazoun) 11 - Added documentation in French (@kamazoun)
3 - Fix logs messages (@damphat) 12 - Fix logs messages (@damphat)
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:get/get.dart'; 2 import 'package:get/get.dart';
3 3
4 -import 'en_US.dart';  
5 -import 'pt_BR.dart'; 4 +import 'en_us.dart';
  5 +import 'pt_br.dart';
6 6
7 class TranslationService extends Translations { 7 class TranslationService extends Translations {
8 - static final locale = Get.deviceLocale; 8 + static Locale get locale => Get.deviceLocale!;
9 static final fallbackLocale = Locale('en', 'US'); 9 static final fallbackLocale = Locale('en', 'US');
10 @override 10 @override
11 Map<String, Map<String, String>> get keys => { 11 Map<String, Map<String, String>> get keys => {
@@ -9,7 +9,7 @@ void main() { @@ -9,7 +9,7 @@ void main() {
9 } 9 }
10 10
11 class MyApp extends StatelessWidget { 11 class MyApp extends StatelessWidget {
12 - const MyApp({Key key}) : super(key: key); 12 + const MyApp({Key? key}) : super(key: key);
13 13
14 @override 14 @override
15 Widget build(BuildContext context) { 15 Widget build(BuildContext context) {
@@ -9,7 +9,8 @@ abstract class IHomeProvider { @@ -9,7 +9,8 @@ abstract class IHomeProvider {
9 class HomeProvider extends GetConnect implements IHomeProvider { 9 class HomeProvider extends GetConnect implements IHomeProvider {
10 @override 10 @override
11 void onInit() { 11 void onInit() {
12 - httpClient.defaultDecoder = CasesModel.fromJson; 12 + httpClient.defaultDecoder =
  13 + (val) => CasesModel.fromJson(val as Map<String, dynamic>);
13 httpClient.baseUrl = 'https://api.covid19api.com'; 14 httpClient.baseUrl = 'https://api.covid19api.com';
14 } 15 }
15 16
@@ -3,16 +3,16 @@ import '../domain/entity/cases_model.dart'; @@ -3,16 +3,16 @@ import '../domain/entity/cases_model.dart';
3 import 'home_api_provider.dart'; 3 import 'home_api_provider.dart';
4 4
5 class HomeRepository implements IHomeRepository { 5 class HomeRepository implements IHomeRepository {
6 - HomeRepository({this.provider}); 6 + HomeRepository({required this.provider});
7 final IHomeProvider provider; 7 final IHomeProvider provider;
8 8
9 @override 9 @override
10 Future<CasesModel> getCases() async { 10 Future<CasesModel> getCases() async {
11 final cases = await provider.getCases("/summary"); 11 final cases = await provider.getCases("/summary");
12 if (cases.status.hasError) { 12 if (cases.status.hasError) {
13 - return Future.error(cases.statusText); 13 + return Future.error(cases.statusText!);
14 } else { 14 } else {
15 - return cases.body; 15 + return cases.body!;
16 } 16 }
17 } 17 }
18 } 18 }
1 // To parse this JSON data, do 1 // To parse this JSON data, do
2 // 2 //
3 -// final CasesModel = CasesModelFromJson(jsonString); 3 +// final welcome = welcomeFromJson(jsonString);
4 4
5 import 'dart:convert'; 5 import 'dart:convert';
6 6
7 class CasesModel { 7 class CasesModel {
8 - final Global global;  
9 - final List<Country> countries;  
10 - final String date;  
11 -  
12 CasesModel({ 8 CasesModel({
13 - this.global,  
14 - this.countries,  
15 - this.date, 9 + required this.id,
  10 + required this.message,
  11 + required this.global,
  12 + required this.countries,
  13 + required this.date,
16 }); 14 });
17 15
18 - static CasesModel fromRawJson(String str) => 16 + final String id;
  17 + final String message;
  18 + final Global global;
  19 + final List<Country> countries;
  20 + final DateTime date;
  21 +
  22 + factory CasesModel.fromRawJson(String str) =>
19 CasesModel.fromJson(json.decode(str) as Map<String, dynamic>); 23 CasesModel.fromJson(json.decode(str) as Map<String, dynamic>);
20 24
21 String toRawJson() => json.encode(toJson()); 25 String toRawJson() => json.encode(toJson());
22 26
23 - static CasesModel fromJson(dynamic json) => CasesModel(  
24 - global: json["Global"] == null  
25 - ? null  
26 - : Global.fromJson(json["Global"] as Map<String, dynamic>),  
27 - countries: json["Countries"] == null  
28 - ? null  
29 - : List<Country>.from(  
30 - (json["Countries"] as List<dynamic>)  
31 - .map((x) => Country.fromJson(x as Map<String, dynamic>)),  
32 - ),  
33 - date: json["Date"] == null ? null : json["Date"] as String, 27 + factory CasesModel.fromJson(Map<String, dynamic> json) => CasesModel(
  28 + id: json["ID"] as String,
  29 + message: json["Message"] as String,
  30 + global: Global.fromJson(json["Global"] as Map<String, dynamic>),
  31 + countries: List<Country>.from((json["Countries"] as Iterable).map(
  32 + (x) => Country.fromJson(x as Map<String, dynamic>),
  33 + )),
  34 + date: DateTime.parse(json["Date"] as String),
34 ); 35 );
35 36
36 Map<String, dynamic> toJson() => { 37 Map<String, dynamic> toJson() => {
37 - "Global": global == null ? null : global.toJson(),  
38 - "Countries": countries == null  
39 - ? null  
40 - : List<dynamic>.from(countries.map((x) => x.toJson())),  
41 - "Date": date == null ? null : date, 38 + "ID": id,
  39 + "Message": message,
  40 + "Global": global.toJson(),
  41 + "Countries": List<dynamic>.from(countries.map((x) => x.toJson())),
  42 + "Date": date.toIso8601String(),
42 }; 43 };
43 } 44 }
44 45
45 class Country { 46 class Country {
  47 + Country({
  48 + required this.id,
  49 + required this.country,
  50 + required this.countryCode,
  51 + required this.slug,
  52 + required this.newConfirmed,
  53 + required this.totalConfirmed,
  54 + required this.newDeaths,
  55 + required this.totalDeaths,
  56 + required this.newRecovered,
  57 + required this.totalRecovered,
  58 + required this.date,
  59 + required this.premium,
  60 + });
  61 +
  62 + final String id;
46 final String country; 63 final String country;
47 final String countryCode; 64 final String countryCode;
48 final String slug; 65 final String slug;
@@ -52,20 +69,8 @@ class Country { @@ -52,20 +69,8 @@ class Country {
52 final int totalDeaths; 69 final int totalDeaths;
53 final int newRecovered; 70 final int newRecovered;
54 final int totalRecovered; 71 final int totalRecovered;
55 - final String date;  
56 -  
57 - Country({  
58 - this.country,  
59 - this.countryCode,  
60 - this.slug,  
61 - this.newConfirmed,  
62 - this.totalConfirmed,  
63 - this.newDeaths,  
64 - this.totalDeaths,  
65 - this.newRecovered,  
66 - this.totalRecovered,  
67 - this.date,  
68 - }); 72 + final DateTime date;
  73 + final Premium premium;
69 74
70 factory Country.fromRawJson(String str) => 75 factory Country.fromRawJson(String str) =>
71 Country.fromJson(json.decode(str) as Map<String, dynamic>); 76 Country.fromJson(json.decode(str) as Map<String, dynamic>);
@@ -73,56 +78,67 @@ class Country { @@ -73,56 +78,67 @@ class Country {
73 String toRawJson() => json.encode(toJson()); 78 String toRawJson() => json.encode(toJson());
74 79
75 factory Country.fromJson(Map<String, dynamic> json) => Country( 80 factory Country.fromJson(Map<String, dynamic> json) => Country(
76 - country: json["Country"] == null ? null : json["Country"] as String,  
77 - countryCode:  
78 - json["CountryCode"] == null ? null : json["CountryCode"] as String,  
79 - slug: json["Slug"] == null ? null : json["Slug"] as String,  
80 - newConfirmed:  
81 - json["NewConfirmed"] == null ? null : json["NewConfirmed"] as int,  
82 - totalConfirmed: json["TotalConfirmed"] == null  
83 - ? null  
84 - : json["TotalConfirmed"] as int,  
85 - newDeaths: json["NewDeaths"] == null ? null : json["NewDeaths"] as int,  
86 - totalDeaths:  
87 - json["TotalDeaths"] == null ? null : json["TotalDeaths"] as int,  
88 - newRecovered:  
89 - json["NewRecovered"] == null ? null : json["NewRecovered"] as int,  
90 - totalRecovered: json["TotalRecovered"] == null  
91 - ? null  
92 - : json["TotalRecovered"] as int,  
93 - date: json["Date"] == null ? null : json["Date"] as String, 81 + id: json["ID"] as String,
  82 + country: json["Country"] as String,
  83 + countryCode: json["CountryCode"] as String,
  84 + slug: json["Slug"] as String,
  85 + newConfirmed: json["NewConfirmed"] as int,
  86 + totalConfirmed: json["TotalConfirmed"] as int,
  87 + newDeaths: json["NewDeaths"] as int,
  88 + totalDeaths: json["TotalDeaths"] as int,
  89 + newRecovered: json["NewRecovered"] as int,
  90 + totalRecovered: json["TotalRecovered"] as int,
  91 + date: DateTime.parse(json["Date"] as String),
  92 + premium: Premium.fromJson(json["Premium"] as Map<String, dynamic>),
94 ); 93 );
95 94
96 Map<String, dynamic> toJson() => { 95 Map<String, dynamic> toJson() => {
97 - "Country": country == null ? null : country,  
98 - "CountryCode": countryCode == null ? null : countryCode,  
99 - "Slug": slug == null ? null : slug,  
100 - "NewConfirmed": newConfirmed == null ? null : newConfirmed,  
101 - "TotalConfirmed": totalConfirmed == null ? null : totalConfirmed,  
102 - "NewDeaths": newDeaths == null ? null : newDeaths,  
103 - "TotalDeaths": totalDeaths == null ? null : totalDeaths,  
104 - "NewRecovered": newRecovered == null ? null : newRecovered,  
105 - "TotalRecovered": totalRecovered == null ? null : totalRecovered,  
106 - "Date": date == null ? null : date, 96 + "ID": id,
  97 + "Country": country,
  98 + "CountryCode": countryCode,
  99 + "Slug": slug,
  100 + "NewConfirmed": newConfirmed,
  101 + "TotalConfirmed": totalConfirmed,
  102 + "NewDeaths": newDeaths,
  103 + "TotalDeaths": totalDeaths,
  104 + "NewRecovered": newRecovered,
  105 + "TotalRecovered": totalRecovered,
  106 + "Date": date.toIso8601String(),
  107 + "Premium": premium.toJson(),
107 }; 108 };
108 } 109 }
109 110
  111 +class Premium {
  112 + Premium();
  113 +
  114 + factory Premium.fromRawJson(String str) =>
  115 + Premium.fromJson(json.decode(str) as Map<String, dynamic>);
  116 +
  117 + String toRawJson() => json.encode(toJson());
  118 +
  119 + factory Premium.fromJson(Map<String, dynamic> json) => Premium();
  120 +
  121 + Map<String, dynamic> toJson() => {};
  122 +}
  123 +
110 class Global { 124 class Global {
  125 + Global({
  126 + required this.newConfirmed,
  127 + required this.totalConfirmed,
  128 + required this.newDeaths,
  129 + required this.totalDeaths,
  130 + required this.newRecovered,
  131 + required this.totalRecovered,
  132 + required this.date,
  133 + });
  134 +
111 final int newConfirmed; 135 final int newConfirmed;
112 final int totalConfirmed; 136 final int totalConfirmed;
113 final int newDeaths; 137 final int newDeaths;
114 final int totalDeaths; 138 final int totalDeaths;
115 final int newRecovered; 139 final int newRecovered;
116 final int totalRecovered; 140 final int totalRecovered;
117 -  
118 - Global({  
119 - this.newConfirmed,  
120 - this.totalConfirmed,  
121 - this.newDeaths,  
122 - this.totalDeaths,  
123 - this.newRecovered,  
124 - this.totalRecovered,  
125 - }); 141 + final DateTime date;
126 142
127 factory Global.fromRawJson(String str) => 143 factory Global.fromRawJson(String str) =>
128 Global.fromJson(json.decode(str) as Map<String, dynamic>); 144 Global.fromJson(json.decode(str) as Map<String, dynamic>);
@@ -130,27 +146,22 @@ class Global { @@ -130,27 +146,22 @@ class Global {
130 String toRawJson() => json.encode(toJson()); 146 String toRawJson() => json.encode(toJson());
131 147
132 factory Global.fromJson(Map<String, dynamic> json) => Global( 148 factory Global.fromJson(Map<String, dynamic> json) => Global(
133 - newConfirmed:  
134 - json["NewConfirmed"] == null ? null : json["NewConfirmed"] as int,  
135 - totalConfirmed: json["TotalConfirmed"] == null  
136 - ? null  
137 - : json["TotalConfirmed"] as int,  
138 - newDeaths: json["NewDeaths"] == null ? null : json["NewDeaths"] as int,  
139 - totalDeaths:  
140 - json["TotalDeaths"] == null ? null : json["TotalDeaths"] as int,  
141 - newRecovered:  
142 - json["NewRecovered"] == null ? null : json["NewRecovered"] as int,  
143 - totalRecovered: json["TotalRecovered"] == null  
144 - ? null  
145 - : json["TotalRecovered"] as int, 149 + newConfirmed: json["NewConfirmed"] as int,
  150 + totalConfirmed: json["TotalConfirmed"] as int,
  151 + newDeaths: json["NewDeaths"] as int,
  152 + totalDeaths: json["TotalDeaths"] as int,
  153 + newRecovered: json["NewRecovered"] as int,
  154 + totalRecovered: json["TotalRecovered"] as int,
  155 + date: DateTime.parse(json["Date"] as String),
146 ); 156 );
147 157
148 Map<String, dynamic> toJson() => { 158 Map<String, dynamic> toJson() => {
149 - "NewConfirmed": newConfirmed == null ? null : newConfirmed,  
150 - "TotalConfirmed": totalConfirmed == null ? null : totalConfirmed,  
151 - "NewDeaths": newDeaths == null ? null : newDeaths,  
152 - "TotalDeaths": totalDeaths == null ? null : totalDeaths,  
153 - "NewRecovered": newRecovered == null ? null : newRecovered,  
154 - "TotalRecovered": totalRecovered == null ? null : totalRecovered, 159 + "NewConfirmed": newConfirmed,
  160 + "TotalConfirmed": totalConfirmed,
  161 + "NewDeaths": newDeaths,
  162 + "TotalDeaths": totalDeaths,
  163 + "NewRecovered": newRecovered,
  164 + "TotalRecovered": totalRecovered,
  165 + "Date": date.toIso8601String(),
155 }; 166 };
156 } 167 }
@@ -4,22 +4,16 @@ import '../../domain/adapters/repository_adapter.dart'; @@ -4,22 +4,16 @@ import '../../domain/adapters/repository_adapter.dart';
4 import '../../domain/entity/cases_model.dart'; 4 import '../../domain/entity/cases_model.dart';
5 5
6 class HomeController extends SuperController<CasesModel> { 6 class HomeController extends SuperController<CasesModel> {
7 - HomeController({this.homeRepository}); 7 + HomeController({required this.homeRepository});
8 8
9 - /// inject repo abstraction dependency  
10 final IHomeRepository homeRepository; 9 final IHomeRepository homeRepository;
11 10
12 - /// When the controller is initialized, make the http request  
13 @override 11 @override
14 void onInit() { 12 void onInit() {
15 super.onInit(); 13 super.onInit();
16 - // show loading on start, data on success  
17 - // and error message on error with 0 boilerplate  
18 - homeRepository.getCases().then((data) {  
19 - change(data, status: RxStatus.success());  
20 - }, onError: (err) {  
21 - change(null, status: RxStatus.error(err.toString()));  
22 - }); 14 +
  15 + //Loading, Success, Error handle with 1 line of code
  16 + append(() => homeRepository.getCases);
23 } 17 }
24 18
25 @override 19 @override
@@ -29,9 +29,9 @@ class CountryView extends GetView<HomeController> { @@ -29,9 +29,9 @@ class CountryView extends GetView<HomeController> {
29 ), 29 ),
30 body: Center( 30 body: Center(
31 child: ListView.builder( 31 child: ListView.builder(
32 - itemCount: controller.state.countries.length, 32 + itemCount: controller.state!.countries.length,
33 itemBuilder: (context, index) { 33 itemBuilder: (context, index) {
34 - final country = controller.state.countries[index]; 34 + final country = controller.state!.countries[index];
35 return ListTile( 35 return ListTile(
36 onTap: () { 36 onTap: () {
37 Get.toNamed('/home/country/details', 37 Get.toNamed('/home/country/details',
@@ -42,7 +42,7 @@ class HomeView extends GetView<HomeController> { @@ -42,7 +42,7 @@ class HomeView extends GetView<HomeController> {
42 ), 42 ),
43 ), 43 ),
44 Text( 44 Text(
45 - '${state.global.totalConfirmed}', 45 + '${state!.global.totalConfirmed}',
46 style: TextStyle(fontSize: 45, fontWeight: FontWeight.bold), 46 style: TextStyle(fontSize: 45, fontWeight: FontWeight.bold),
47 ), 47 ),
48 SizedBox( 48 SizedBox(
@@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev @@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
18 version: 1.0.0+1 18 version: 1.0.0+1
19 19
20 environment: 20 environment:
21 - sdk: ">=2.7.0 <3.0.0" 21 + sdk: ">=2.12.0 <3.0.0"
22 22
23 dependencies: 23 dependencies:
24 flutter: 24 flutter:
@@ -6,8 +6,8 @@ import 'package:get/get.dart'; @@ -6,8 +6,8 @@ import 'package:get/get.dart';
6 import 'package:get_demo/pages/home/domain/adapters/repository_adapter.dart'; 6 import 'package:get_demo/pages/home/domain/adapters/repository_adapter.dart';
7 import 'package:get_demo/pages/home/domain/entity/cases_model.dart'; 7 import 'package:get_demo/pages/home/domain/entity/cases_model.dart';
8 import 'package:get_demo/pages/home/presentation/controllers/home_controller.dart'; 8 import 'package:get_demo/pages/home/presentation/controllers/home_controller.dart';
9 -import 'package:get_demo/routes/app_pages.dart';  
10 -import 'package:get_test/get_test.dart'; 9 +// import 'package:get_demo/routes/app_pages.dart';
  10 +// import 'package:get_test/get_test.dart';
11 import 'package:matcher/matcher.dart' as m; 11 import 'package:matcher/matcher.dart' as m;
12 12
13 class MockRepository implements IHomeRepository { 13 class MockRepository implements IHomeRepository {
@@ -17,7 +17,18 @@ class MockRepository implements IHomeRepository { @@ -17,7 +17,18 @@ class MockRepository implements IHomeRepository {
17 17
18 if (Random().nextBool()) { 18 if (Random().nextBool()) {
19 return CasesModel( 19 return CasesModel(
20 - global: Global(totalDeaths: 100, totalConfirmed: 200), 20 + global: Global(
  21 + totalDeaths: 100,
  22 + totalConfirmed: 200,
  23 + date: DateTime.now(),
  24 + newConfirmed: 0,
  25 + newDeaths: 0,
  26 + newRecovered: 0,
  27 + totalRecovered: 0),
  28 + countries: [],
  29 + date: DateTime.now(),
  30 + id: '',
  31 + message: '',
21 ); 32 );
22 } 33 }
23 34
@@ -26,6 +37,7 @@ class MockRepository implements IHomeRepository { @@ -26,6 +37,7 @@ class MockRepository implements IHomeRepository {
26 } 37 }
27 38
28 void main() { 39 void main() {
  40 + WidgetsFlutterBinding.ensureInitialized();
29 setUpAll(() => HttpOverrides.global = null); 41 setUpAll(() => HttpOverrides.global = null);
30 final binding = BindingsBuilder(() { 42 final binding = BindingsBuilder(() {
31 Get.lazyPut<IHomeRepository>(() => MockRepository()); 43 Get.lazyPut<IHomeRepository>(() => MockRepository());
@@ -69,13 +81,15 @@ void main() { @@ -69,13 +81,15 @@ void main() {
69 } 81 }
70 82
71 if (controller.status.isSuccess) { 83 if (controller.status.isSuccess) {
72 - expect(controller.state.global.totalDeaths, 100);  
73 - expect(controller.state.global.totalConfirmed, 200); 84 + expect(controller.state!.global.totalDeaths, 100);
  85 + expect(controller.state!.global.totalConfirmed, 200);
74 } 86 }
75 }); 87 });
76 88
77 /// Tests with GetTests 89 /// Tests with GetTests
78 - getTest( 90 + /// TEMPORARILY REMOVED from the null-safetym branch as
  91 + /// get_test is not yet null safety.
  92 + /* getTest(
79 "test description", 93 "test description",
80 getPages: AppPages.routes, 94 getPages: AppPages.routes,
81 initialRoute: AppPages.INITIAL, 95 initialRoute: AppPages.INITIAL,
@@ -104,33 +118,6 @@ void main() { @@ -104,33 +118,6 @@ void main() {
104 ), 118 ),
105 test: (e) { 119 test: (e) {
106 expect(find.text("ban:0"), findsOneWidget); 120 expect(find.text("ban:0"), findsOneWidget);
107 - expect(e.count.value, 0);  
108 - },  
109 - );  
110 -  
111 - testGetBuilder(  
112 - 'GetBuilder test',  
113 - widget: GetBuilder<Controller>(  
114 - init: Controller(),  
115 - builder: (controller) {  
116 - return Text("ban:${controller.count}");  
117 - },  
118 - ),  
119 - test: (e) {  
120 - expect(find.text("ban:0"), findsOneWidget);  
121 - expect(e.count.value, 0);  
122 - },  
123 - );  
124 -  
125 - testObx(  
126 - 'Obx test',  
127 - widget: (controller) => Obx(  
128 - () => Text("ban:${controller.count}"),  
129 - ),  
130 - controller: Controller(),  
131 - test: (e) {  
132 - expect(find.text("ban:0"), findsOneWidget);  
133 - expect(e.count.value, 0);  
134 }, 121 },
135 ); 122 );
136 123
@@ -151,7 +138,7 @@ void main() { @@ -151,7 +138,7 @@ void main() {
151 onClose: (c) { 138 onClose: (c) {
152 print('onClose'); 139 print('onClose');
153 }, 140 },
154 - ); 141 + );*/
155 } 142 }
156 143
157 class Controller extends GetxController { 144 class Controller extends GetxController {
@@ -13,74 +13,74 @@ export 'http/src/response/response.dart'; @@ -13,74 +13,74 @@ export 'http/src/response/response.dart';
13 export 'sockets/sockets.dart'; 13 export 'sockets/sockets.dart';
14 14
15 abstract class GetConnectInterface with GetLifeCycleBase { 15 abstract class GetConnectInterface with GetLifeCycleBase {
16 - List<GetSocket> sockets; 16 + List<GetSocket>? sockets;
17 GetHttpClient get httpClient; 17 GetHttpClient get httpClient;
18 18
19 Future<Response<T>> get<T>( 19 Future<Response<T>> get<T>(
20 String url, { 20 String url, {
21 - Map<String, String> headers,  
22 - String contentType,  
23 - Map<String, dynamic> query,  
24 - Decoder<T> decoder, 21 + Map<String, String>? headers,
  22 + String? contentType,
  23 + Map<String, dynamic>? query,
  24 + Decoder<T>? decoder,
25 }); 25 });
26 26
27 Future<Response<T>> request<T>( 27 Future<Response<T>> request<T>(
28 String url, 28 String url,
29 String method, { 29 String method, {
30 dynamic body, 30 dynamic body,
31 - String contentType,  
32 - Map<String, String> headers,  
33 - Map<String, dynamic> query,  
34 - Decoder<T> decoder, 31 + String? contentType,
  32 + Map<String, String>? headers,
  33 + Map<String, dynamic>? query,
  34 + Decoder<T>? decoder,
35 }); 35 });
36 Future<Response<T>> post<T>( 36 Future<Response<T>> post<T>(
37 String url, 37 String url,
38 dynamic body, { 38 dynamic body, {
39 - String contentType,  
40 - Map<String, String> headers,  
41 - Map<String, dynamic> query,  
42 - Decoder<T> decoder, 39 + String? contentType,
  40 + Map<String, String>? headers,
  41 + Map<String, dynamic>? query,
  42 + Decoder<T>? decoder,
43 }); 43 });
44 44
45 Future<Response<T>> put<T>( 45 Future<Response<T>> put<T>(
46 String url, 46 String url,
47 dynamic body, { 47 dynamic body, {
48 - String contentType,  
49 - Map<String, String> headers,  
50 - Map<String, dynamic> query,  
51 - Decoder<T> decoder, 48 + String? contentType,
  49 + Map<String, String>? headers,
  50 + Map<String, dynamic>? query,
  51 + Decoder<T>? decoder,
52 }); 52 });
53 53
54 Future<Response<T>> delete<T>( 54 Future<Response<T>> delete<T>(
55 String url, { 55 String url, {
56 - Map<String, String> headers,  
57 - String contentType,  
58 - Map<String, dynamic> query,  
59 - Decoder<T> decoder, 56 + Map<String, String>? headers,
  57 + String? contentType,
  58 + Map<String, dynamic>? query,
  59 + Decoder<T>? decoder,
60 }); 60 });
61 61
62 Future<Response<T>> patch<T>( 62 Future<Response<T>> patch<T>(
63 String url, 63 String url,
64 dynamic body, { 64 dynamic body, {
65 - String contentType,  
66 - Map<String, String> headers,  
67 - Map<String, dynamic> query,  
68 - Decoder<T> decoder,  
69 - Progress uploadProgress, 65 + String? contentType,
  66 + Map<String, String>? headers,
  67 + Map<String, dynamic>? query,
  68 + Decoder<T>? decoder,
  69 + Progress? uploadProgress,
70 }); 70 });
71 71
72 Future<GraphQLResponse<T>> query<T>( 72 Future<GraphQLResponse<T>> query<T>(
73 String query, { 73 String query, {
74 - String url,  
75 - Map<String, dynamic> variables,  
76 - Map<String, String> headers, 74 + String? url,
  75 + Map<String, dynamic>? variables,
  76 + Map<String, String>? headers,
77 }); 77 });
78 78
79 Future<GraphQLResponse<T>> mutation<T>( 79 Future<GraphQLResponse<T>> mutation<T>(
80 String mutation, { 80 String mutation, {
81 - String url,  
82 - Map<String, dynamic> variables,  
83 - Map<String, String> headers, 81 + String? url,
  82 + Map<String, dynamic>? variables,
  83 + Map<String, String>? headers,
84 }); 84 });
85 85
86 GetSocket socket( 86 GetSocket socket(
@@ -103,16 +103,16 @@ class GetConnect extends GetConnectInterface { @@ -103,16 +103,16 @@ class GetConnect extends GetConnectInterface {
103 103
104 bool allowAutoSignedCert; 104 bool allowAutoSignedCert;
105 String userAgent; 105 String userAgent;
106 - String baseUrl; 106 + String? baseUrl;
107 String defaultContentType = 'application/json; charset=utf-8'; 107 String defaultContentType = 'application/json; charset=utf-8';
108 bool followRedirects; 108 bool followRedirects;
109 int maxRedirects; 109 int maxRedirects;
110 int maxAuthRetries; 110 int maxAuthRetries;
111 - Decoder defaultDecoder; 111 + Decoder? defaultDecoder;
112 Duration timeout; 112 Duration timeout;
113 - List<TrustedCertificate> trustedCertificates;  
114 - GetHttpClient _httpClient;  
115 - List<GetSocket> _sockets; 113 + List<TrustedCertificate>? trustedCertificates;
  114 + GetHttpClient? _httpClient;
  115 + List<GetSocket>? _sockets;
116 116
117 @override 117 @override
118 List<GetSocket> get sockets => _sockets ??= <GetSocket>[]; 118 List<GetSocket> get sockets => _sockets ??= <GetSocket>[];
@@ -132,10 +132,10 @@ class GetConnect extends GetConnectInterface { @@ -132,10 +132,10 @@ class GetConnect extends GetConnectInterface {
132 @override 132 @override
133 Future<Response<T>> get<T>( 133 Future<Response<T>> get<T>(
134 String url, { 134 String url, {
135 - Map<String, String> headers,  
136 - String contentType,  
137 - Map<String, dynamic> query,  
138 - Decoder<T> decoder, 135 + Map<String, String>? headers,
  136 + String? contentType,
  137 + Map<String, dynamic>? query,
  138 + Decoder<T>? decoder,
139 }) { 139 }) {
140 _checkIfDisposed(); 140 _checkIfDisposed();
141 return httpClient.get<T>( 141 return httpClient.get<T>(
@@ -149,13 +149,13 @@ class GetConnect extends GetConnectInterface { @@ -149,13 +149,13 @@ class GetConnect extends GetConnectInterface {
149 149
150 @override 150 @override
151 Future<Response<T>> post<T>( 151 Future<Response<T>> post<T>(
152 - String url, 152 + String? url,
153 dynamic body, { 153 dynamic body, {
154 - String contentType,  
155 - Map<String, String> headers,  
156 - Map<String, dynamic> query,  
157 - Decoder<T> decoder,  
158 - Progress uploadProgress, 154 + String? contentType,
  155 + Map<String, String>? headers,
  156 + Map<String, dynamic>? query,
  157 + Decoder<T>? decoder,
  158 + Progress? uploadProgress,
159 }) { 159 }) {
160 _checkIfDisposed(); 160 _checkIfDisposed();
161 return httpClient.post<T>( 161 return httpClient.post<T>(
@@ -173,11 +173,11 @@ class GetConnect extends GetConnectInterface { @@ -173,11 +173,11 @@ class GetConnect extends GetConnectInterface {
173 Future<Response<T>> put<T>( 173 Future<Response<T>> put<T>(
174 String url, 174 String url,
175 dynamic body, { 175 dynamic body, {
176 - String contentType,  
177 - Map<String, String> headers,  
178 - Map<String, dynamic> query,  
179 - Decoder<T> decoder,  
180 - Progress uploadProgress, 176 + String? contentType,
  177 + Map<String, String>? headers,
  178 + Map<String, dynamic>? query,
  179 + Decoder<T>? decoder,
  180 + Progress? uploadProgress,
181 }) { 181 }) {
182 _checkIfDisposed(); 182 _checkIfDisposed();
183 return httpClient.put<T>( 183 return httpClient.put<T>(
@@ -195,11 +195,11 @@ class GetConnect extends GetConnectInterface { @@ -195,11 +195,11 @@ class GetConnect extends GetConnectInterface {
195 Future<Response<T>> patch<T>( 195 Future<Response<T>> patch<T>(
196 String url, 196 String url,
197 dynamic body, { 197 dynamic body, {
198 - String contentType,  
199 - Map<String, String> headers,  
200 - Map<String, dynamic> query,  
201 - Decoder<T> decoder,  
202 - Progress uploadProgress, 198 + String? contentType,
  199 + Map<String, String>? headers,
  200 + Map<String, dynamic>? query,
  201 + Decoder<T>? decoder,
  202 + Progress? uploadProgress,
203 }) { 203 }) {
204 _checkIfDisposed(); 204 _checkIfDisposed();
205 return httpClient.patch<T>( 205 return httpClient.patch<T>(
@@ -218,11 +218,11 @@ class GetConnect extends GetConnectInterface { @@ -218,11 +218,11 @@ class GetConnect extends GetConnectInterface {
218 String url, 218 String url,
219 String method, { 219 String method, {
220 dynamic body, 220 dynamic body,
221 - String contentType,  
222 - Map<String, String> headers,  
223 - Map<String, dynamic> query,  
224 - Decoder<T> decoder,  
225 - Progress uploadProgress, 221 + String? contentType,
  222 + Map<String, String>? headers,
  223 + Map<String, dynamic>? query,
  224 + Decoder<T>? decoder,
  225 + Progress? uploadProgress,
226 }) { 226 }) {
227 _checkIfDisposed(); 227 _checkIfDisposed();
228 return httpClient.request<T>( 228 return httpClient.request<T>(
@@ -240,10 +240,10 @@ class GetConnect extends GetConnectInterface { @@ -240,10 +240,10 @@ class GetConnect extends GetConnectInterface {
240 @override 240 @override
241 Future<Response<T>> delete<T>( 241 Future<Response<T>> delete<T>(
242 String url, { 242 String url, {
243 - Map<String, String> headers,  
244 - String contentType,  
245 - Map<String, dynamic> query,  
246 - Decoder<T> decoder, 243 + Map<String, String>? headers,
  244 + String? contentType,
  245 + Map<String, dynamic>? query,
  246 + Decoder<T>? decoder,
247 }) { 247 }) {
248 _checkIfDisposed(); 248 _checkIfDisposed();
249 return httpClient.delete( 249 return httpClient.delete(
@@ -262,14 +262,14 @@ class GetConnect extends GetConnectInterface { @@ -262,14 +262,14 @@ 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 }
269 269
270 - String _concatUrl(String url) { 270 + String? _concatUrl(String? url) {
271 if (url == null) return baseUrl; 271 if (url == null) return baseUrl;
272 - return baseUrl == null ? url : baseUrl + url; 272 + return baseUrl == null ? url : baseUrl! + url;
273 } 273 }
274 274
275 /// query allow made GraphQL raw querys 275 /// query allow made GraphQL raw querys
@@ -294,9 +294,9 @@ class GetConnect extends GetConnectInterface { @@ -294,9 +294,9 @@ class GetConnect extends GetConnectInterface {
294 @override 294 @override
295 Future<GraphQLResponse<T>> query<T>( 295 Future<GraphQLResponse<T>> query<T>(
296 String query, { 296 String query, {
297 - String url,  
298 - Map<String, dynamic> variables,  
299 - Map<String, String> headers, 297 + String? url,
  298 + Map<String, dynamic>? variables,
  299 + Map<String, String>? headers,
300 }) async { 300 }) async {
301 try { 301 try {
302 final res = await post( 302 final res = await post(
@@ -316,7 +316,7 @@ class GetConnect extends GetConnectInterface { @@ -316,7 +316,7 @@ class GetConnect extends GetConnectInterface {
316 )) 316 ))
317 .toList()); 317 .toList());
318 } 318 }
319 - return GraphQLResponse<T>(body: res.body['data'] as T); 319 + return GraphQLResponse<T>(body: res.body['data'] as T?);
320 } on Exception catch (_) { 320 } on Exception catch (_) {
321 return GraphQLResponse<T>(graphQLErrors: [ 321 return GraphQLResponse<T>(graphQLErrors: [
322 GraphQLError( 322 GraphQLError(
@@ -330,9 +330,9 @@ class GetConnect extends GetConnectInterface { @@ -330,9 +330,9 @@ class GetConnect extends GetConnectInterface {
330 @override 330 @override
331 Future<GraphQLResponse<T>> mutation<T>( 331 Future<GraphQLResponse<T>> mutation<T>(
332 String mutation, { 332 String mutation, {
333 - String url,  
334 - Map<String, dynamic> variables,  
335 - Map<String, String> headers, 333 + String? url,
  334 + Map<String, dynamic>? variables,
  335 + Map<String, String>? headers,
336 }) async { 336 }) async {
337 try { 337 try {
338 final res = await post( 338 final res = await post(
@@ -352,7 +352,7 @@ class GetConnect extends GetConnectInterface { @@ -352,7 +352,7 @@ class GetConnect extends GetConnectInterface {
352 )) 352 ))
353 .toList()); 353 .toList());
354 } 354 }
355 - return GraphQLResponse<T>(body: res.body['data'] as T); 355 + return GraphQLResponse<T>(body: res.body['data'] as T?);
356 } on Exception catch (_) { 356 } on Exception catch (_) {
357 return GraphQLResponse<T>(graphQLErrors: [ 357 return GraphQLResponse<T>(graphQLErrors: [
358 GraphQLError( 358 GraphQLError(
1 class GetHttpException implements Exception { 1 class GetHttpException implements Exception {
2 final String message; 2 final String message;
3 3
4 - final Uri uri; 4 + final Uri? uri;
5 5
6 GetHttpException(this.message, [this.uri]); 6 GetHttpException(this.message, [this.uri]);
7 7
@@ -11,8 +11,8 @@ class GetHttpException implements Exception { @@ -11,8 +11,8 @@ class GetHttpException implements Exception {
11 11
12 class GraphQLError { 12 class GraphQLError {
13 GraphQLError({this.code, this.message}); 13 GraphQLError({this.code, this.message});
14 - final String message;  
15 - final String code; 14 + final String? message;
  15 + final String? code;
16 16
17 @override 17 @override
18 String toString() => 'GETCONNECT ERROR:\n\tcode:$code\n\tmessage:$message'; 18 String toString() => 'GETCONNECT ERROR:\n\tcode:$code\n\tmessage:$message';
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';
@@ -20,7 +19,7 @@ typedef Progress = Function(double percent); @@ -20,7 +19,7 @@ typedef Progress = Function(double percent);
20 19
21 class GetHttpClient { 20 class GetHttpClient {
22 String userAgent; 21 String userAgent;
23 - String baseUrl; 22 + String? baseUrl;
24 23
25 String defaultContentType = 'application/json; charset=utf-8'; 24 String defaultContentType = 'application/json; charset=utf-8';
26 25
@@ -28,7 +27,7 @@ class GetHttpClient { @@ -28,7 +27,7 @@ class GetHttpClient {
28 int maxRedirects; 27 int maxRedirects;
29 int maxAuthRetries; 28 int maxAuthRetries;
30 29
31 - Decoder defaultDecoder; 30 + Decoder? defaultDecoder;
32 31
33 Duration timeout; 32 Duration timeout;
34 33
@@ -46,7 +45,7 @@ class GetHttpClient { @@ -46,7 +45,7 @@ class GetHttpClient {
46 this.maxAuthRetries = 1, 45 this.maxAuthRetries = 1,
47 bool allowAutoSignedCert = false, 46 bool allowAutoSignedCert = false,
48 this.baseUrl, 47 this.baseUrl,
49 - List<TrustedCertificate> trustedCertificates, 48 + List<TrustedCertificate>? trustedCertificates,
50 }) : _httpClient = HttpRequestImpl( 49 }) : _httpClient = HttpRequestImpl(
51 allowAutoSignedCert: allowAutoSignedCert, 50 allowAutoSignedCert: allowAutoSignedCert,
52 trustedCertificates: trustedCertificates, 51 trustedCertificates: trustedCertificates,
@@ -73,11 +72,11 @@ class GetHttpClient { @@ -73,11 +72,11 @@ class GetHttpClient {
73 _modifier.removeResponseModifier<T>(interceptor); 72 _modifier.removeResponseModifier<T>(interceptor);
74 } 73 }
75 74
76 - Uri _createUri(String url, Map<String, dynamic> query) { 75 + Uri _createUri(String? url, Map<String, dynamic>? query) {
77 if (baseUrl != null) { 76 if (baseUrl != null) {
78 - url = baseUrl + url; 77 + url = baseUrl! + url!;
79 } 78 }
80 - final uri = Uri.parse(url); 79 + final uri = Uri.parse(url!);
81 if (query != null) { 80 if (query != null) {
82 return uri.replace(queryParameters: query); 81 return uri.replace(queryParameters: query);
83 } 82 }
@@ -85,16 +84,16 @@ class GetHttpClient { @@ -85,16 +84,16 @@ class GetHttpClient {
85 } 84 }
86 85
87 Future<Request<T>> _requestWithBody<T>( 86 Future<Request<T>> _requestWithBody<T>(
88 - String url,  
89 - String contentType, 87 + String? url,
  88 + String? contentType,
90 dynamic body, 89 dynamic body,
91 String method, 90 String method,
92 - Map<String, dynamic> query,  
93 - Decoder<T> decoder,  
94 - Progress uploadProgress, 91 + Map<String, dynamic>? query,
  92 + Decoder<T>? decoder,
  93 + Progress? uploadProgress,
95 ) async { 94 ) async {
96 - List<int> bodyBytes;  
97 - BodyBytesStream bodyStream; 95 + List<int>? bodyBytes;
  96 + Stream<List<int>>? bodyStream;
98 final headers = <String, String>{}; 97 final headers = <String, String>{};
99 98
100 headers['user-agent'] = userAgent; 99 headers['user-agent'] = userAgent;
@@ -146,9 +145,9 @@ class GetHttpClient { @@ -146,9 +145,9 @@ class GetHttpClient {
146 ); 145 );
147 } 146 }
148 147
149 - BodyBytesStream _trackProgress( 148 + Stream<List<int>> _trackProgress(
150 List<int> bodyBytes, 149 List<int> bodyBytes,
151 - Progress uploadProgress, 150 + Progress? uploadProgress,
152 ) { 151 ) {
153 var total = 0; 152 var total = 0;
154 var length = bodyBytes.length; 153 var length = bodyBytes.length;
@@ -164,12 +163,12 @@ class GetHttpClient { @@ -164,12 +163,12 @@ class GetHttpClient {
164 sink.add(data); 163 sink.add(data);
165 }), 164 }),
166 ); 165 );
167 - return BodyBytesStream(byteStream); 166 + return byteStream;
168 } 167 }
169 168
170 void _setSimpleHeaders( 169 void _setSimpleHeaders(
171 Map<String, String> headers, 170 Map<String, String> headers,
172 - String contentType, 171 + String? contentType,
173 ) { 172 ) {
174 headers['content-type'] = contentType ?? defaultContentType; 173 headers['content-type'] = contentType ?? defaultContentType;
175 headers['user-agent'] = userAgent; 174 headers['user-agent'] = userAgent;
@@ -179,7 +178,7 @@ class GetHttpClient { @@ -179,7 +178,7 @@ class GetHttpClient {
179 HandlerExecute<T> handler, { 178 HandlerExecute<T> handler, {
180 bool authenticate = false, 179 bool authenticate = false,
181 int requestNumber = 1, 180 int requestNumber = 1,
182 - Map<String, String> headers, 181 + Map<String, String>? headers,
183 }) async { 182 }) async {
184 try { 183 try {
185 var request = await handler(); 184 var request = await handler();
@@ -188,7 +187,7 @@ class GetHttpClient { @@ -188,7 +187,7 @@ class GetHttpClient {
188 request.headers[key] = value; 187 request.headers[key] = value;
189 }); 188 });
190 189
191 - if (authenticate) await _modifier.authenticator(request); 190 + if (authenticate) await _modifier.authenticator!(request);
192 await _modifier.modifyRequest(request); 191 await _modifier.modifyRequest(request);
193 192
194 var response = await _httpClient.send<T>(request); 193 var response = await _httpClient.send<T>(request);
@@ -238,9 +237,9 @@ class GetHttpClient { @@ -238,9 +237,9 @@ class GetHttpClient {
238 237
239 Future<Request<T>> _get<T>( 238 Future<Request<T>> _get<T>(
240 String url, 239 String url,
241 - String contentType,  
242 - Map<String, dynamic> query,  
243 - Decoder<T> decoder, 240 + String? contentType,
  241 + Map<String, dynamic>? query,
  242 + Decoder<T>? decoder,
244 ) { 243 ) {
245 final headers = <String, String>{}; 244 final headers = <String, String>{};
246 _setSimpleHeaders(headers, contentType); 245 _setSimpleHeaders(headers, contentType);
@@ -256,13 +255,13 @@ class GetHttpClient { @@ -256,13 +255,13 @@ class GetHttpClient {
256 } 255 }
257 256
258 Future<Request<T>> _request<T>( 257 Future<Request<T>> _request<T>(
259 - String url, 258 + String? url,
260 String method, { 259 String method, {
261 - String contentType,  
262 - @required dynamic body,  
263 - @required Map<String, dynamic> query,  
264 - Decoder<T> decoder,  
265 - @required Progress uploadProgress, 260 + String? contentType,
  261 + required dynamic body,
  262 + required Map<String, dynamic>? query,
  263 + Decoder<T>? decoder,
  264 + required Progress? uploadProgress,
266 }) { 265 }) {
267 return _requestWithBody<T>( 266 return _requestWithBody<T>(
268 url, 267 url,
@@ -270,16 +269,16 @@ class GetHttpClient { @@ -270,16 +269,16 @@ class GetHttpClient {
270 body, 269 body,
271 method, 270 method,
272 query, 271 query,
273 - decoder ?? (defaultDecoder as Decoder<T>), 272 + decoder ?? (defaultDecoder as Decoder<T>?),
274 uploadProgress, 273 uploadProgress,
275 ); 274 );
276 } 275 }
277 276
278 Request<T> _delete<T>( 277 Request<T> _delete<T>(
279 String url, 278 String url,
280 - String contentType,  
281 - Map<String, dynamic> query,  
282 - Decoder<T> decoder, 279 + String? contentType,
  280 + Map<String, dynamic>? query,
  281 + Decoder<T>? decoder,
283 ) { 282 ) {
284 final headers = <String, String>{}; 283 final headers = <String, String>{};
285 _setSimpleHeaders(headers, contentType); 284 _setSimpleHeaders(headers, contentType);
@@ -289,18 +288,18 @@ class GetHttpClient { @@ -289,18 +288,18 @@ class GetHttpClient {
289 method: 'delete', 288 method: 'delete',
290 url: uri, 289 url: uri,
291 headers: headers, 290 headers: headers,
292 - decoder: decoder ?? (defaultDecoder as Decoder<T>), 291 + decoder: decoder ?? (defaultDecoder as Decoder<T>?),
293 ); 292 );
294 } 293 }
295 294
296 Future<Response<T>> patch<T>( 295 Future<Response<T>> patch<T>(
297 String url, { 296 String url, {
298 dynamic body, 297 dynamic body,
299 - String contentType,  
300 - Map<String, String> headers,  
301 - Map<String, dynamic> query,  
302 - Decoder<T> decoder,  
303 - Progress uploadProgress, 298 + String? contentType,
  299 + Map<String, String>? headers,
  300 + Map<String, dynamic>? query,
  301 + Decoder<T>? decoder,
  302 + Progress? uploadProgress,
304 // List<MultipartFile> files, 303 // List<MultipartFile> files,
305 }) async { 304 }) async {
306 try { 305 try {
@@ -328,13 +327,13 @@ class GetHttpClient { @@ -328,13 +327,13 @@ class GetHttpClient {
328 } 327 }
329 328
330 Future<Response<T>> post<T>( 329 Future<Response<T>> post<T>(
331 - String url, { 330 + String? url, {
332 dynamic body, 331 dynamic body,
333 - String contentType,  
334 - Map<String, String> headers,  
335 - Map<String, dynamic> query,  
336 - Decoder<T> decoder,  
337 - Progress uploadProgress, 332 + String? contentType,
  333 + Map<String, String>? headers,
  334 + Map<String, dynamic>? query,
  335 + Decoder<T>? decoder,
  336 + Progress? uploadProgress,
338 // List<MultipartFile> files, 337 // List<MultipartFile> files,
339 }) async { 338 }) async {
340 try { 339 try {
@@ -365,11 +364,11 @@ class GetHttpClient { @@ -365,11 +364,11 @@ class GetHttpClient {
365 String url, 364 String url,
366 String method, { 365 String method, {
367 dynamic body, 366 dynamic body,
368 - String contentType,  
369 - Map<String, String> headers,  
370 - Map<String, dynamic> query,  
371 - Decoder<T> decoder,  
372 - Progress uploadProgress, 367 + String? contentType,
  368 + Map<String, String>? headers,
  369 + Map<String, dynamic>? query,
  370 + Decoder<T>? decoder,
  371 + Progress? uploadProgress,
373 }) async { 372 }) async {
374 try { 373 try {
375 var response = await _performRequest<T>( 374 var response = await _performRequest<T>(
@@ -398,11 +397,11 @@ class GetHttpClient { @@ -398,11 +397,11 @@ class GetHttpClient {
398 Future<Response<T>> put<T>( 397 Future<Response<T>> put<T>(
399 String url, { 398 String url, {
400 dynamic body, 399 dynamic body,
401 - String contentType,  
402 - Map<String, String> headers,  
403 - Map<String, dynamic> query,  
404 - Decoder<T> decoder,  
405 - Progress uploadProgress, 400 + String? contentType,
  401 + Map<String, String>? headers,
  402 + Map<String, dynamic>? query,
  403 + Decoder<T>? decoder,
  404 + Progress? uploadProgress,
406 }) async { 405 }) async {
407 try { 406 try {
408 var response = await _performRequest<T>( 407 var response = await _performRequest<T>(
@@ -430,10 +429,10 @@ class GetHttpClient { @@ -430,10 +429,10 @@ class GetHttpClient {
430 429
431 Future<Response<T>> get<T>( 430 Future<Response<T>> get<T>(
432 String url, { 431 String url, {
433 - Map<String, String> headers,  
434 - String contentType,  
435 - Map<String, dynamic> query,  
436 - Decoder<T> decoder, 432 + Map<String, String>? headers,
  433 + String? contentType,
  434 + Map<String, dynamic>? query,
  435 + Decoder<T>? decoder,
437 }) async { 436 }) async {
438 try { 437 try {
439 var response = await _performRequest<T>( 438 var response = await _performRequest<T>(
@@ -514,10 +513,10 @@ class GetHttpClient { @@ -514,10 +513,10 @@ class GetHttpClient {
514 513
515 Future<Response<T>> delete<T>( 514 Future<Response<T>> delete<T>(
516 String url, { 515 String url, {
517 - Map<String, String> headers,  
518 - String contentType,  
519 - Map<String, dynamic> query,  
520 - Decoder<T> decoder, 516 + Map<String, String>? headers,
  517 + String? contentType,
  518 + Map<String, dynamic>? query,
  519 + Decoder<T>? decoder,
521 }) async { 520 }) async {
522 try { 521 try {
523 var response = await _performRequest<T>( 522 var response = await _performRequest<T>(
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:html' as html; 2 import 'dart:html' as html;
3 -import 'dart:typed_data';  
4 3
5 import '../../certificates/certificates.dart'; 4 import '../../certificates/certificates.dart';
6 import '../../exceptions/exceptions.dart'; 5 import '../../exceptions/exceptions.dart';
@@ -13,7 +12,7 @@ import '../utils/body_decoder.dart'; @@ -13,7 +12,7 @@ import '../utils/body_decoder.dart';
13 class HttpRequestImpl implements HttpRequestBase { 12 class HttpRequestImpl implements HttpRequestBase {
14 HttpRequestImpl({ 13 HttpRequestImpl({
15 bool allowAutoSignedCert = true, 14 bool allowAutoSignedCert = true,
16 - List<TrustedCertificate> trustedCertificates, 15 + List<TrustedCertificate>? trustedCertificates,
17 }); 16 });
18 17
19 /// The currently active XHRs. 18 /// The currently active XHRs.
@@ -38,19 +37,20 @@ class HttpRequestImpl implements HttpRequestBase { @@ -38,19 +37,20 @@ class HttpRequestImpl implements HttpRequestBase {
38 ..responseType = 'blob' 37 ..responseType = 'blob'
39 ..withCredentials = withCredentials; 38 ..withCredentials = withCredentials;
40 request.headers.forEach(xhr.setRequestHeader); 39 request.headers.forEach(xhr.setRequestHeader);
  40 + request.contentLength ?? -1;
41 41
42 var completer = Completer<Response<T>>(); 42 var completer = Completer<Response<T>>();
43 xhr.onLoad.first.then((_) { 43 xhr.onLoad.first.then((_) {
44 - var blob = xhr.response as html.Blob ?? html.Blob([]); 44 + var blob = xhr.response as html.Blob? ?? html.Blob([]);
45 var reader = html.FileReader(); 45 var reader = html.FileReader();
46 46
47 reader.onLoad.first.then((_) async { 47 reader.onLoad.first.then((_) async {
48 - var bodyBytes = BodyBytesStream.fromBytes(reader.result as Uint8List); 48 + var bodyBytes = BodyBytesStream.fromBytes(reader.result as List<int>);
49 49
50 final stringBody = 50 final stringBody =
51 await bodyBytesToString(bodyBytes, xhr.responseHeaders); 51 await bodyBytesToString(bodyBytes, xhr.responseHeaders);
52 52
53 - String contentType; 53 + String? contentType;
54 54
55 if (xhr.responseHeaders.containsKey('content-type')) { 55 if (xhr.responseHeaders.containsKey('content-type')) {
56 contentType = xhr.responseHeaders['content-type']; 56 contentType = xhr.responseHeaders['content-type'];
@@ -10,24 +10,24 @@ import '../utils/body_decoder.dart'; @@ -10,24 +10,24 @@ import '../utils/body_decoder.dart';
10 10
11 /// A `dart:io` implementation of `HttpRequestBase`. 11 /// A `dart:io` implementation of `HttpRequestBase`.
12 class HttpRequestImpl extends HttpRequestBase { 12 class HttpRequestImpl extends HttpRequestBase {
13 - io.HttpClient _httpClient;  
14 - io.SecurityContext _securityContext; 13 + io.HttpClient? _httpClient;
  14 + io.SecurityContext? _securityContext;
15 15
16 HttpRequestImpl({ 16 HttpRequestImpl({
17 bool allowAutoSignedCert = true, 17 bool allowAutoSignedCert = true,
18 - List<TrustedCertificate> trustedCertificates, 18 + List<TrustedCertificate>? trustedCertificates,
19 }) { 19 }) {
20 _httpClient = io.HttpClient(); 20 _httpClient = io.HttpClient();
21 if (trustedCertificates != null) { 21 if (trustedCertificates != null) {
22 _securityContext = io.SecurityContext(); 22 _securityContext = io.SecurityContext();
23 for (final trustedCertificate in trustedCertificates) { 23 for (final trustedCertificate in trustedCertificates) {
24 - _securityContext 24 + _securityContext!
25 .setTrustedCertificatesBytes(List.from(trustedCertificate.bytes)); 25 .setTrustedCertificatesBytes(List.from(trustedCertificate.bytes));
26 } 26 }
27 } 27 }
28 28
29 _httpClient = io.HttpClient(context: _securityContext); 29 _httpClient = io.HttpClient(context: _securityContext);
30 - _httpClient.badCertificateCallback = (_, __, ___) => allowAutoSignedCert; 30 + _httpClient!.badCertificateCallback = (_, __, ___) => allowAutoSignedCert;
31 } 31 }
32 32
33 @override 33 @override
@@ -36,7 +36,7 @@ class HttpRequestImpl extends HttpRequestBase { @@ -36,7 +36,7 @@ class HttpRequestImpl extends HttpRequestBase {
36 //var stream = BodyBytesStream.fromBytes(requestBody ?? const []); 36 //var stream = BodyBytesStream.fromBytes(requestBody ?? const []);
37 37
38 try { 38 try {
39 - var ioRequest = (await _httpClient.openUrl(request.method, request.url)) 39 + var ioRequest = (await _httpClient!.openUrl(request.method, request.url))
40 ..followRedirects = request.followRedirects 40 ..followRedirects = request.followRedirects
41 ..persistentConnection = request.persistentConnection 41 ..persistentConnection = request.persistentConnection
42 ..maxRedirects = request.maxRedirects 42 ..maxRedirects = request.maxRedirects
@@ -50,7 +50,7 @@ class HttpRequestImpl extends HttpRequestBase { @@ -50,7 +50,7 @@ class HttpRequestImpl extends HttpRequestBase {
50 headers[key] = values.join(','); 50 headers[key] = values.join(',');
51 }); 51 });
52 52
53 - final bodyBytes = BodyBytesStream(response); 53 + final bodyBytes = (response);
54 final stringBody = await bodyBytesToString(bodyBytes, headers); 54 final stringBody = await bodyBytesToString(bodyBytes, headers);
55 55
56 final body = bodyDecoded<T>( 56 final body = bodyDecoded<T>(
@@ -77,7 +77,7 @@ class HttpRequestImpl extends HttpRequestBase { @@ -77,7 +77,7 @@ class HttpRequestImpl extends HttpRequestBase {
77 @override 77 @override
78 void close() { 78 void close() {
79 if (_httpClient != null) { 79 if (_httpClient != null) {
80 - _httpClient.close(force: true); 80 + _httpClient!.close(force: true);
81 _httpClient = null; 81 _httpClient = null;
82 } 82 }
83 } 83 }
@@ -16,14 +16,14 @@ class MockClient extends HttpRequestBase { @@ -16,14 +16,14 @@ 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
23 - final stringBody = await bodyBytesToString(bodyBytes, response.headers); 23 + final stringBody = await bodyBytesToString(bodyBytes, response.headers!);
24 24
25 - var mimeType = response.headers.containsKey('content-type')  
26 - ? response.headers['content-type'] 25 + var mimeType = response.headers!.containsKey('content-type')
  26 + ? response.headers!['content-type']
27 : ''; 27 : '';
28 28
29 final body = bodyDecoded<T>( 29 final body = bodyDecoded<T>(
@@ -6,7 +6,7 @@ import '../interface/request_base.dart'; @@ -6,7 +6,7 @@ import '../interface/request_base.dart';
6 class HttpRequestImpl extends HttpRequestBase { 6 class HttpRequestImpl extends HttpRequestBase {
7 HttpRequestImpl({ 7 HttpRequestImpl({
8 bool allowAutoSignedCert = true, 8 bool allowAutoSignedCert = true,
9 - List<TrustedCertificate> trustedCertificates, 9 + List<TrustedCertificate>? trustedCertificates,
10 }); 10 });
11 @override 11 @override
12 void close() {} 12 void close() {}
@@ -4,8 +4,8 @@ import '../../../../../get_core/get_core.dart'; @@ -4,8 +4,8 @@ import '../../../../../get_core/get_core.dart';
4 4
5 import '../../request/request.dart'; 5 import '../../request/request.dart';
6 6
7 -T bodyDecoded<T>(Request<T> request, String stringBody, String mimeType) {  
8 - T body; 7 +T? bodyDecoded<T>(Request<T> request, String stringBody, String? mimeType) {
  8 + T? body;
9 var bodyToDecode; 9 var bodyToDecode;
10 10
11 if (mimeType != null && mimeType.contains('application/json')) { 11 if (mimeType != null && mimeType.contains('application/json')) {
@@ -23,9 +23,9 @@ T bodyDecoded<T>(Request<T> request, String stringBody, String mimeType) { @@ -23,9 +23,9 @@ T bodyDecoded<T>(Request<T> request, String stringBody, String mimeType) {
23 if (stringBody == '') { 23 if (stringBody == '') {
24 body = null; 24 body = null;
25 } else if (request.decoder == null) { 25 } else if (request.decoder == null) {
26 - body = bodyToDecode as T; 26 + body = bodyToDecode as T?;
27 } else { 27 } else {
28 - body = request.decoder(bodyToDecode); 28 + body = request.decoder!(bodyToDecode);
29 } 29 }
30 } on Exception catch (_) { 30 } on Exception catch (_) {
31 body = stringBody as T; 31 body = stringBody as T;
@@ -3,17 +3,17 @@ import 'dart:async'; @@ -3,17 +3,17 @@ import 'dart:async';
3 import '../request/request.dart'; 3 import '../request/request.dart';
4 import '../response/response.dart'; 4 import '../response/response.dart';
5 5
6 -typedef RequestModifier<T> = FutureOr<Request<T>> Function(Request<T> request); 6 +typedef RequestModifier<T> = FutureOr<Request<T>> Function(Request<T?> request);
7 7
8 typedef ResponseModifier<T> = FutureOr Function( 8 typedef ResponseModifier<T> = FutureOr Function(
9 - Request<T> request, Response<T> response); 9 + Request<T?> request, Response<T?> response);
10 10
11 typedef HandlerExecute<T> = Future<Request<T>> Function(); 11 typedef HandlerExecute<T> = Future<Request<T>> Function();
12 12
13 class GetModifier<T> { 13 class GetModifier<T> {
14 final _requestModifiers = <RequestModifier>[]; 14 final _requestModifiers = <RequestModifier>[];
15 final _responseModifiers = <ResponseModifier>[]; 15 final _responseModifiers = <ResponseModifier>[];
16 - RequestModifier authenticator; 16 + RequestModifier? authenticator;
17 17
18 void addRequestModifier<T>(RequestModifier<T> interceptor) { 18 void addRequestModifier<T>(RequestModifier<T> interceptor) {
19 _requestModifiers.add(interceptor as RequestModifier); 19 _requestModifiers.add(interceptor as RequestModifier);
@@ -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)}"'; 60 header = '$header; filename="${browserEncode(file.value.filename)}"';
62 - }  
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';
@@ -83,7 +81,7 @@ class FormData { @@ -83,7 +81,7 @@ class FormData {
83 _maxBoundaryLength + 81 _maxBoundaryLength +
84 '\r\n'.length + 82 '\r\n'.length +
85 utf8.encode(_fileHeader(file)).length + 83 utf8.encode(_fileHeader(file)).length +
86 - file.value.length + 84 + file.value.length! +
87 '\r\n'.length; 85 '\r\n'.length;
88 } 86 }
89 87
@@ -109,7 +107,7 @@ class FormData { @@ -109,7 +107,7 @@ class FormData {
109 for (final file in files) { 107 for (final file in files) {
110 yield separator; 108 yield separator;
111 yield utf8.encode(_fileHeader(file)); 109 yield utf8.encode(_fileHeader(file));
112 - yield* file.value.stream; 110 + yield* file.value.stream!;
113 yield line; 111 yield line;
114 } 112 }
115 yield close; 113 yield close;
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';
@@ -9,7 +7,7 @@ import '../request/request.dart'; @@ -9,7 +7,7 @@ import '../request/request.dart';
9 class MultipartFile { 7 class MultipartFile {
10 MultipartFile( 8 MultipartFile(
11 dynamic data, { 9 dynamic data, {
12 - @required this.filename, 10 + required this.filename,
13 this.contentType = 'application/octet-stream', 11 this.contentType = 'application/octet-stream',
14 }) : _bytes = fileToBytes(data) { 12 }) : _bytes = fileToBytes(data) {
15 _length = _bytes.length; 13 _length = _bytes.length;
@@ -21,13 +19,13 @@ class MultipartFile { @@ -21,13 +19,13 @@ class MultipartFile {
21 final String contentType; 19 final String contentType;
22 20
23 /// This stream will emit the file content of File. 21 /// This stream will emit the file content of File.
24 - BodyBytesStream _stream; 22 + Stream<List<int>>? _stream;
25 23
26 - int _length; 24 + int? _length;
27 25
28 - BodyBytesStream get stream => _stream; 26 + Stream<List<int>>? get stream => _stream;
29 27
30 - int get length => _length; 28 + int? get length => _length;
31 29
32 final String filename; 30 final String filename;
33 } 31 }
@@ -2,8 +2,6 @@ import 'dart:async'; @@ -2,8 +2,6 @@ import 'dart:async';
2 import 'dart:convert'; 2 import 'dart:convert';
3 import 'dart:typed_data'; 3 import 'dart:typed_data';
4 4
5 -import 'package:flutter/foundation.dart';  
6 -  
7 import '../http.dart'; 5 import '../http.dart';
8 import '../multipart/form_data.dart'; 6 import '../multipart/form_data.dart';
9 7
@@ -14,16 +12,16 @@ class Request<T> { @@ -14,16 +12,16 @@ class Request<T> {
14 /// The [Uri] from request 12 /// The [Uri] from request
15 final Uri url; 13 final Uri url;
16 14
17 - final Decoder<T> decoder; 15 + final Decoder<T>? decoder;
18 16
19 /// The Http Method from this [Request] 17 /// The Http Method from this [Request]
20 /// ex: `GET`,`POST`,`PUT`,`DELETE` 18 /// ex: `GET`,`POST`,`PUT`,`DELETE`
21 final String method; 19 final String method;
22 20
23 - final int contentLength; 21 + final int? contentLength;
24 22
25 /// The BodyBytesStream of body from this [Request] 23 /// The BodyBytesStream of body from this [Request]
26 - final BodyBytesStream bodyBytes; 24 + final Stream<List<int>> bodyBytes;
27 25
28 /// When true, the client will follow redirects to resolves this [Request] 26 /// When true, the client will follow redirects to resolves this [Request]
29 final bool followRedirects; 27 final bool followRedirects;
@@ -33,45 +31,41 @@ class Request<T> { @@ -33,45 +31,41 @@ class Request<T> {
33 31
34 final bool persistentConnection; 32 final bool persistentConnection;
35 33
36 - final FormData files; 34 + final FormData? files;
37 35
38 const Request._({ 36 const Request._({
39 - @required this.method,  
40 - @required this.bodyBytes,  
41 - @required this.url,  
42 - @required this.headers,  
43 - @required this.contentLength,  
44 - @required this.followRedirects,  
45 - @required this.maxRedirects,  
46 - @required this.files,  
47 - @required this.persistentConnection,  
48 - @required this.decoder, 37 + required this.method,
  38 + required this.bodyBytes,
  39 + required this.url,
  40 + required this.headers,
  41 + required this.contentLength,
  42 + required this.followRedirects,
  43 + required this.maxRedirects,
  44 + required this.files,
  45 + required this.persistentConnection,
  46 + required this.decoder,
49 }); 47 });
50 48
51 factory Request({ 49 factory Request({
52 - @required Uri url,  
53 - @required String method,  
54 - @required Map<String, String> headers,  
55 - BodyBytesStream bodyBytes, 50 + required Uri url,
  51 + required String method,
  52 + required Map<String, String> headers,
  53 + Stream<List<int>>? bodyBytes,
56 bool followRedirects = true, 54 bool followRedirects = true,
57 int maxRedirects = 4, 55 int maxRedirects = 4,
58 - int contentLength,  
59 - FormData files, 56 + int? contentLength,
  57 + FormData? files,
60 bool persistentConnection = true, 58 bool persistentConnection = true,
61 - Decoder<T> decoder, 59 + Decoder<T>? decoder,
62 }) { 60 }) {
63 - assert(url != null);  
64 - assert(method != null);  
65 - assert(followRedirects != null);  
66 if (followRedirects) { 61 if (followRedirects) {
67 - assert(maxRedirects != null);  
68 assert(maxRedirects > 0); 62 assert(maxRedirects > 0);
69 } 63 }
70 return Request._( 64 return Request._(
71 url: url, 65 url: url,
72 method: method, 66 method: method,
73 bodyBytes: bodyBytes ??= BodyBytesStream.fromBytes(const []), 67 bodyBytes: bodyBytes ??= BodyBytesStream.fromBytes(const []),
74 - headers: Map.from(headers ??= <String, String>{}), 68 + headers: Map.from(headers),
75 followRedirects: followRedirects, 69 followRedirects: followRedirects,
76 maxRedirects: maxRedirects, 70 maxRedirects: maxRedirects,
77 contentLength: contentLength, 71 contentLength: contentLength,
@@ -82,11 +76,9 @@ class Request<T> { @@ -82,11 +76,9 @@ class Request<T> {
82 } 76 }
83 } 77 }
84 78
85 -class BodyBytesStream extends StreamView<List<int>> {  
86 - BodyBytesStream(Stream<List<int>> stream) : super(stream);  
87 -  
88 - factory BodyBytesStream.fromBytes(List<int> bytes) =>  
89 - BodyBytesStream(Stream.fromIterable([bytes])); 79 +extension BodyBytesStream on Stream<List<int>> {
  80 + static Stream<List<int>> fromBytes(List<int> bytes) =>
  81 + Stream.fromIterable([bytes]);
90 82
91 Future<Uint8List> toBytes() { 83 Future<Uint8List> toBytes() {
92 var completer = Completer<Uint8List>(); 84 var completer = Completer<Uint8List>();
@@ -95,7 +87,7 @@ class BodyBytesStream extends StreamView<List<int>> { @@ -95,7 +87,7 @@ class BodyBytesStream extends StreamView<List<int>> {
95 Uint8List.fromList(bytes), 87 Uint8List.fromList(bytes),
96 ), 88 ),
97 ); 89 );
98 - listen(sink.add, 90 + listen((val) => sink.add(val),
99 onError: completer.completeError, 91 onError: completer.completeError,
100 onDone: sink.close, 92 onDone: sink.close,
101 cancelOnError: true); 93 cancelOnError: true);
@@ -5,8 +5,8 @@ import '../request/request.dart'; @@ -5,8 +5,8 @@ import '../request/request.dart';
5 import '../status/http_status.dart'; 5 import '../status/http_status.dart';
6 6
7 class GraphQLResponse<T> extends Response<T> { 7 class GraphQLResponse<T> extends Response<T> {
8 - final List<GraphQLError> graphQLErrors;  
9 - GraphQLResponse({T body, this.graphQLErrors}) : super(body: body); 8 + final List<GraphQLError>? graphQLErrors;
  9 + GraphQLResponse({T? body, this.graphQLErrors}) : super(body: body);
10 } 10 }
11 11
12 class Response<T> { 12 class Response<T> {
@@ -21,16 +21,16 @@ class Response<T> { @@ -21,16 +21,16 @@ class Response<T> {
21 }); 21 });
22 22
23 /// The Http [Request] linked with this [Response]. 23 /// The Http [Request] linked with this [Response].
24 - final Request request; 24 + final Request? request;
25 25
26 /// The response headers. 26 /// The response headers.
27 - final Map<String, String> headers; 27 + final Map<String, String>? headers;
28 28
29 /// The status code returned by the server. 29 /// The status code returned by the server.
30 - final int statusCode; 30 + final int? statusCode;
31 31
32 /// Human-readable context for [statusCode]. 32 /// Human-readable context for [statusCode].
33 - final String statusText; 33 + final String? statusText;
34 34
35 /// [HttpStatus] from [Response]. `status.connectionError` is true 35 /// [HttpStatus] from [Response]. `status.connectionError` is true
36 /// when statusCode is null. `status.isUnauthorized` is true when 36 /// when statusCode is null. `status.isUnauthorized` is true when
@@ -49,19 +49,19 @@ class Response<T> { @@ -49,19 +49,19 @@ class Response<T> {
49 bool get unauthorized => status.isUnauthorized; 49 bool get unauthorized => status.isUnauthorized;
50 50
51 /// The response body as a Stream of Bytes. 51 /// The response body as a Stream of Bytes.
52 - final BodyBytesStream bodyBytes; 52 + final Stream<List<int>>? bodyBytes;
53 53
54 /// The response body as a Stream of Bytes. 54 /// The response body as a Stream of Bytes.
55 - final String bodyString; 55 + final String? bodyString;
56 56
57 /// The decoded body of this [Response]. You can access the 57 /// The decoded body of this [Response]. You can access the
58 /// body parameters as Map 58 /// body parameters as Map
59 /// Ex: body['title']; 59 /// Ex: body['title'];
60 - final T body; 60 + final T? body;
61 } 61 }
62 62
63 Future<String> bodyBytesToString( 63 Future<String> bodyBytesToString(
64 - BodyBytesStream bodyBytes, Map<String, String> headers) { 64 + Stream<List<int>> bodyBytes, Map<String, String> headers) {
65 return bodyBytes.bytesToString(_encodingForHeaders(headers)); 65 return bodyBytes.bytesToString(_encodingForHeaders(headers));
66 } 66 }
67 67
@@ -70,13 +70,13 @@ Future<String> bodyBytesToString( @@ -70,13 +70,13 @@ Future<String> bodyBytesToString(
70 /// Defaults to [latin1] if the headers don't specify a charset or if that 70 /// Defaults to [latin1] if the headers don't specify a charset or if that
71 /// charset is unknown. 71 /// charset is unknown.
72 Encoding _encodingForHeaders(Map<String, String> headers) => 72 Encoding _encodingForHeaders(Map<String, String> headers) =>
73 - _encodingForCharset(_contentTypeForHeaders(headers).parameters['charset']); 73 + _encodingForCharset(_contentTypeForHeaders(headers).parameters!['charset']);
74 74
75 /// Returns the [Encoding] that corresponds to [charset]. 75 /// Returns the [Encoding] that corresponds to [charset].
76 /// 76 ///
77 /// Returns [fallback] if [charset] is null or if no [Encoding] was found that 77 /// Returns [fallback] if [charset] is null or if no [Encoding] was found that
78 /// corresponds to [charset]. 78 /// corresponds to [charset].
79 -Encoding _encodingForCharset(String charset, [Encoding fallback = latin1]) { 79 +Encoding _encodingForCharset(String? charset, [Encoding fallback = latin1]) {
80 if (charset == null) return fallback; 80 if (charset == null) return fallback;
81 return Encoding.getByName(charset) ?? fallback; 81 return Encoding.getByName(charset) ?? fallback;
82 } 82 }
@@ -92,10 +92,10 @@ HeaderValue _contentTypeForHeaders(Map<String, String> headers) { @@ -92,10 +92,10 @@ HeaderValue _contentTypeForHeaders(Map<String, String> headers) {
92 92
93 class HeaderValue { 93 class HeaderValue {
94 String _value; 94 String _value;
95 - Map<String, String> _parameters;  
96 - Map<String, String> _unmodifiableParameters; 95 + Map<String, String?>? _parameters;
  96 + Map<String, String?>? _unmodifiableParameters;
97 97
98 - HeaderValue([this._value = '', Map<String, String> parameters]) { 98 + HeaderValue([this._value = '', Map<String, String>? parameters]) {
99 if (parameters != null) { 99 if (parameters != null) {
100 _parameters = HashMap<String, String>.from(parameters); 100 _parameters = HashMap<String, String>.from(parameters);
101 } 101 }
@@ -103,7 +103,7 @@ class HeaderValue { @@ -103,7 +103,7 @@ class HeaderValue {
103 103
104 static HeaderValue parse(String value, 104 static HeaderValue parse(String value,
105 {String parameterSeparator = ';', 105 {String parameterSeparator = ';',
106 - String valueSeparator, 106 + String? valueSeparator,
107 bool preserveBackslash = false}) { 107 bool preserveBackslash = false}) {
108 var result = HeaderValue(); 108 var result = HeaderValue();
109 result._parse(value, parameterSeparator, valueSeparator, preserveBackslash); 109 result._parse(value, parameterSeparator, valueSeparator, preserveBackslash);
@@ -116,9 +116,9 @@ class HeaderValue { @@ -116,9 +116,9 @@ class HeaderValue {
116 _parameters ??= HashMap<String, String>(); 116 _parameters ??= HashMap<String, String>();
117 } 117 }
118 118
119 - Map<String, String> get parameters { 119 + Map<String, String?>? get parameters {
120 _ensureParameters(); 120 _ensureParameters();
121 - _unmodifiableParameters ??= UnmodifiableMapView(_parameters); 121 + _unmodifiableParameters ??= UnmodifiableMapView(_parameters!);
122 return _unmodifiableParameters; 122 return _unmodifiableParameters;
123 } 123 }
124 124
@@ -126,15 +126,15 @@ class HeaderValue { @@ -126,15 +126,15 @@ class HeaderValue {
126 String toString() { 126 String toString() {
127 var stringBuffer = StringBuffer(); 127 var stringBuffer = StringBuffer();
128 stringBuffer.write(_value); 128 stringBuffer.write(_value);
129 - if (parameters != null && parameters.isNotEmpty) {  
130 - _parameters.forEach((name, value) { 129 + if (parameters != null && parameters!.isNotEmpty) {
  130 + _parameters!.forEach((name, value) {
131 stringBuffer..write('; ')..write(name)..write('=')..write(value); 131 stringBuffer..write('; ')..write(name)..write('=')..write(value);
132 }); 132 });
133 } 133 }
134 return stringBuffer.toString(); 134 return stringBuffer.toString();
135 } 135 }
136 136
137 - void _parse(String value, String parameterSeparator, String valueSeparator, 137 + void _parse(String value, String parameterSeparator, String? valueSeparator,
138 bool preserveBackslash) { 138 bool preserveBackslash) {
139 var index = 0; 139 var index = 0;
140 140
@@ -173,7 +173,7 @@ class HeaderValue { @@ -173,7 +173,7 @@ class HeaderValue {
173 } 173 }
174 174
175 void parseParameters() { 175 void parseParameters() {
176 - var parameters = HashMap<String, String>(); 176 + var parameters = HashMap<String, String?>();
177 _parameters = UnmodifiableMapView(parameters); 177 _parameters = UnmodifiableMapView(parameters);
178 178
179 String parseParameterName() { 179 String parseParameterName() {
@@ -191,7 +191,7 @@ class HeaderValue { @@ -191,7 +191,7 @@ class HeaderValue {
191 return value.substring(start, index).toLowerCase(); 191 return value.substring(start, index).toLowerCase();
192 } 192 }
193 193
194 - String parseParameterValue() { 194 + String? parseParameterValue() {
195 if (!done() && value[index] == '\"') { 195 if (!done() && value[index] == '\"') {
196 var stringBuffer = StringBuffer(); 196 var stringBuffer = StringBuffer();
197 index++; 197 index++;
1 class HttpStatus { 1 class HttpStatus {
2 HttpStatus(this.code); 2 HttpStatus(this.code);
3 3
4 - final int code; 4 + final int? code;
5 5
6 static const int continue_ = 100; 6 static const int continue_ = 100;
7 static const int switchingProtocols = 101; 7 static const int switchingProtocols = 101;
@@ -83,7 +83,7 @@ class HttpStatus { @@ -83,7 +83,7 @@ class HttpStatus {
83 between(internalServerError, networkConnectTimeoutError); 83 between(internalServerError, networkConnectTimeoutError);
84 84
85 bool between(int begin, int end) { 85 bool between(int begin, int end) {
86 - return !connectionError && code >= begin && code <= end; 86 + return !connectionError && code! >= begin && code! <= end;
87 } 87 }
88 88
89 bool get isOk => between(200, 299); 89 bool get isOk => between(200, 299);
1 -import 'dart:async';  
2 import 'dart:convert'; 1 import 'dart:convert';
3 -import '../request/request.dart';  
4 2
5 bool isTokenChar(int byte) { 3 bool isTokenChar(int byte) {
6 return byte > 31 && byte < 128 && !SEPARATOR_MAP[byte]; 4 return byte > 31 && byte < 128 && !SEPARATOR_MAP[byte];
@@ -52,10 +50,9 @@ String validateField(String field) { @@ -52,10 +50,9 @@ String validateField(String field) {
52 return field.toLowerCase(); 50 return field.toLowerCase();
53 } 51 }
54 52
55 -BodyBytesStream toBodyBytesStream(Stream<List<int>> stream) {  
56 - if (stream is BodyBytesStream) return stream;  
57 - return BodyBytesStream(stream);  
58 -} 53 +// Stream<List<int>> toBodyBytesStream(Stream<List<int>> stream) {
  54 +// return (stream);
  55 +// }
59 56
60 final _asciiOnly = RegExp(r'^[\x00-\x7F]+$'); 57 final _asciiOnly = RegExp(r'^[\x00-\x7F]+$');
61 58
1 import 'dart:convert'; 1 import 'dart:convert';
2 2
3 class Close { 3 class Close {
4 - final String message;  
5 - final int reason; 4 + final String? message;
  5 + final int? reason;
6 6
7 Close(this.message, this.reason); 7 Close(this.message, this.reason);
8 8
@@ -19,31 +19,31 @@ typedef CloseSocket = void Function(Close); @@ -19,31 +19,31 @@ typedef CloseSocket = void Function(Close);
19 typedef MessageSocket = void Function(dynamic val); 19 typedef MessageSocket = void Function(dynamic val);
20 20
21 class SocketNotifier { 21 class SocketNotifier {
22 - var _onMessages = <MessageSocket>[];  
23 - var _onEvents = <String, MessageSocket>{};  
24 - var _onCloses = <CloseSocket>[];  
25 - var _onErrors = <CloseSocket>[]; 22 + List<void Function(dynamic)>? _onMessages = <MessageSocket>[];
  23 + Map<String, void Function(dynamic)>? _onEvents = <String, MessageSocket>{};
  24 + List<void Function(Close)>? _onCloses = <CloseSocket>[];
  25 + List<void Function(Close)>? _onErrors = <CloseSocket>[];
26 26
27 - OpenSocket open; 27 + late OpenSocket open;
28 28
29 void addMessages(MessageSocket socket) { 29 void addMessages(MessageSocket socket) {
30 - _onMessages.add((socket)); 30 + _onMessages!.add((socket));
31 } 31 }
32 32
33 void addEvents(String event, MessageSocket socket) { 33 void addEvents(String event, MessageSocket socket) {
34 - _onEvents[event] = socket; 34 + _onEvents![event] = socket;
35 } 35 }
36 36
37 void addCloses(CloseSocket socket) { 37 void addCloses(CloseSocket socket) {
38 - _onCloses.add(socket); 38 + _onCloses!.add(socket);
39 } 39 }
40 40
41 void addErrors(CloseSocket socket) { 41 void addErrors(CloseSocket socket) {
42 - _onErrors.add((socket)); 42 + _onErrors!.add((socket));
43 } 43 }
44 44
45 void notifyData(dynamic data) { 45 void notifyData(dynamic data) {
46 - for (var item in _onMessages) { 46 + for (var item in _onMessages!) {
47 item(data); 47 item(data);
48 } 48 }
49 if (data is String) { 49 if (data is String) {
@@ -52,14 +52,14 @@ class SocketNotifier { @@ -52,14 +52,14 @@ class SocketNotifier {
52 } 52 }
53 53
54 void notifyClose(Close err) { 54 void notifyClose(Close err) {
55 - for (var item in _onCloses) { 55 + for (var item in _onCloses!) {
56 item(err); 56 item(err);
57 } 57 }
58 } 58 }
59 59
60 void notifyError(Close err) { 60 void notifyError(Close err) {
61 // rooms.removeWhere((key, value) => value.contains(_ws)); 61 // rooms.removeWhere((key, value) => value.contains(_ws));
62 - for (var item in _onErrors) { 62 + for (var item in _onErrors!) {
63 item(err); 63 item(err);
64 } 64 }
65 } 65 }
@@ -69,8 +69,8 @@ class SocketNotifier { @@ -69,8 +69,8 @@ class SocketNotifier {
69 var msg = jsonDecode(message); 69 var msg = jsonDecode(message);
70 final event = msg['type']; 70 final event = msg['type'];
71 final data = msg['data']; 71 final data = msg['data'];
72 - if (_onEvents.containsKey(event)) {  
73 - _onEvents[event](data); 72 + if (_onEvents!.containsKey(event)) {
  73 + _onEvents![event]!(data);
74 } 74 }
75 } on Exception catch (_) { 75 } on Exception catch (_) {
76 return; 76 return;
@@ -15,8 +15,8 @@ enum ConnectionStatus { @@ -15,8 +15,8 @@ enum ConnectionStatus {
15 15
16 class BaseWebSocket { 16 class BaseWebSocket {
17 String url; 17 String url;
18 - WebSocket socket;  
19 - SocketNotifier socketNotifier = SocketNotifier(); 18 + WebSocket? socket;
  19 + SocketNotifier? socketNotifier = SocketNotifier();
20 Duration ping; 20 Duration ping;
21 bool isDisposed = false; 21 bool isDisposed = false;
22 bool allowSelfSigned; 22 bool allowSelfSigned;
@@ -30,39 +30,39 @@ class BaseWebSocket { @@ -30,39 +30,39 @@ class BaseWebSocket {
30 ? url.replaceAll('https:', 'wss:') 30 ? url.replaceAll('https:', 'wss:')
31 : url.replaceAll('http:', 'ws:'); 31 : url.replaceAll('http:', 'ws:');
32 } 32 }
33 - ConnectionStatus connectionStatus;  
34 - Timer _t; 33 + ConnectionStatus? connectionStatus;
  34 + Timer? _t;
35 35
36 void connect() { 36 void connect() {
37 try { 37 try {
38 connectionStatus = ConnectionStatus.connecting; 38 connectionStatus = ConnectionStatus.connecting;
39 socket = WebSocket(url); 39 socket = WebSocket(url);
40 - socket.onOpen.listen((e) { 40 + socket!.onOpen.listen((e) {
41 socketNotifier?.open(); 41 socketNotifier?.open();
42 _t = Timer?.periodic(ping, (t) { 42 _t = Timer?.periodic(ping, (t) {
43 - socket.send(''); 43 + socket!.send('');
44 }); 44 });
45 connectionStatus = ConnectionStatus.connected; 45 connectionStatus = ConnectionStatus.connected;
46 }); 46 });
47 47
48 - socket.onMessage.listen((event) {  
49 - socketNotifier.notifyData(event.data); 48 + socket!.onMessage.listen((event) {
  49 + socketNotifier!.notifyData(event.data);
50 }); 50 });
51 51
52 - socket.onClose.listen((e) { 52 + socket!.onClose.listen((e) {
53 _t?.cancel(); 53 _t?.cancel();
54 54
55 connectionStatus = ConnectionStatus.closed; 55 connectionStatus = ConnectionStatus.closed;
56 - socketNotifier.notifyClose(Close(e.reason, e.code)); 56 + socketNotifier!.notifyClose(Close(e.reason, e.code));
57 }); 57 });
58 - socket.onError.listen((event) { 58 + socket!.onError.listen((event) {
59 _t?.cancel(); 59 _t?.cancel();
60 - socketNotifier.notifyError(Close(event.toString(), 0)); 60 + socketNotifier!.notifyError(Close(event.toString(), 0));
61 connectionStatus = ConnectionStatus.closed; 61 connectionStatus = ConnectionStatus.closed;
62 }); 62 });
63 } on Exception catch (e) { 63 } on Exception catch (e) {
64 _t?.cancel(); 64 _t?.cancel();
65 - socketNotifier.notifyError(Close(e.toString(), 500)); 65 + socketNotifier!.notifyError(Close(e.toString(), 500));
66 connectionStatus = ConnectionStatus.closed; 66 connectionStatus = ConnectionStatus.closed;
67 // close(500, e.toString()); 67 // close(500, e.toString());
68 } 68 }
@@ -70,35 +70,35 @@ class BaseWebSocket { @@ -70,35 +70,35 @@ class BaseWebSocket {
70 70
71 // ignore: use_setters_to_change_properties 71 // ignore: use_setters_to_change_properties
72 void onOpen(OpenSocket fn) { 72 void onOpen(OpenSocket fn) {
73 - socketNotifier.open = fn; 73 + socketNotifier!.open = fn;
74 } 74 }
75 75
76 void onClose(CloseSocket fn) { 76 void onClose(CloseSocket fn) {
77 - socketNotifier.addCloses(fn); 77 + socketNotifier!.addCloses(fn);
78 } 78 }
79 79
80 void onError(CloseSocket fn) { 80 void onError(CloseSocket fn) {
81 - socketNotifier.addErrors(fn); 81 + socketNotifier!.addErrors(fn);
82 } 82 }
83 83
84 void onMessage(MessageSocket fn) { 84 void onMessage(MessageSocket fn) {
85 - socketNotifier.addMessages(fn); 85 + socketNotifier!.addMessages(fn);
86 } 86 }
87 87
88 void on(String event, MessageSocket message) { 88 void on(String event, MessageSocket message) {
89 - socketNotifier.addEvents(event, message); 89 + socketNotifier!.addEvents(event, message);
90 } 90 }
91 91
92 - void close([int status, String reason]) {  
93 - if (socket != null) socket.close(status, reason); 92 + void close([int? status, String? reason]) {
  93 + if (socket != null) socket!.close(status, reason);
94 } 94 }
95 95
96 void send(dynamic data) { 96 void send(dynamic data) {
97 if (connectionStatus == ConnectionStatus.closed) { 97 if (connectionStatus == ConnectionStatus.closed) {
98 connect(); 98 connect();
99 } 99 }
100 - if (socket != null && socket.readyState == WebSocket.OPEN) {  
101 - socket.send(data); 100 + if (socket != null && socket!.readyState == WebSocket.OPEN) {
  101 + socket!.send(data);
102 } else { 102 } else {
103 Get.log('WebSocket not connected, message $data not sent'); 103 Get.log('WebSocket not connected, message $data not sent');
104 } 104 }
@@ -109,7 +109,7 @@ class BaseWebSocket { @@ -109,7 +109,7 @@ class BaseWebSocket {
109 } 109 }
110 110
111 void dispose() { 111 void dispose() {
112 - socketNotifier.dispose(); 112 + socketNotifier!.dispose();
113 socketNotifier = null; 113 socketNotifier = null;
114 isDisposed = true; 114 isDisposed = true;
115 } 115 }
@@ -15,8 +15,8 @@ enum ConnectionStatus { @@ -15,8 +15,8 @@ enum ConnectionStatus {
15 15
16 class BaseWebSocket { 16 class BaseWebSocket {
17 String url; 17 String url;
18 - WebSocket socket;  
19 - SocketNotifier socketNotifier = SocketNotifier(); 18 + WebSocket? socket;
  19 + SocketNotifier? socketNotifier = SocketNotifier();
20 bool isDisposed = false; 20 bool isDisposed = false;
21 BaseWebSocket( 21 BaseWebSocket(
22 this.url, { 22 this.url, {
@@ -26,7 +26,7 @@ class BaseWebSocket { @@ -26,7 +26,7 @@ class BaseWebSocket {
26 Duration ping; 26 Duration ping;
27 bool allowSelfSigned; 27 bool allowSelfSigned;
28 28
29 - ConnectionStatus connectionStatus; 29 + ConnectionStatus? connectionStatus;
30 30
31 Future connect() async { 31 Future connect() async {
32 if (isDisposed) { 32 if (isDisposed) {
@@ -38,51 +38,52 @@ class BaseWebSocket { @@ -38,51 +38,52 @@ class BaseWebSocket {
38 ? await _connectForSelfSignedCert(url) 38 ? await _connectForSelfSignedCert(url)
39 : await WebSocket.connect(url); 39 : await WebSocket.connect(url);
40 40
41 - socket.pingInterval = ping; 41 + socket!.pingInterval = ping;
42 socketNotifier?.open(); 42 socketNotifier?.open();
43 connectionStatus = ConnectionStatus.connected; 43 connectionStatus = ConnectionStatus.connected;
44 44
45 - socket.listen((data) {  
46 - socketNotifier.notifyData(data); 45 + socket!.listen((data) {
  46 + socketNotifier!.notifyData(data);
47 }, onError: (err) { 47 }, onError: (err) {
48 - socketNotifier.notifyError(Close(err.toString(), 1005)); 48 + socketNotifier!.notifyError(Close(err.toString(), 1005));
49 }, onDone: () { 49 }, onDone: () {
50 connectionStatus = ConnectionStatus.closed; 50 connectionStatus = ConnectionStatus.closed;
51 - socketNotifier  
52 - .notifyClose(Close('Connection Closed', socket.closeCode)); 51 + socketNotifier!
  52 + .notifyClose(Close('Connection Closed', socket!.closeCode));
53 }, cancelOnError: true); 53 }, cancelOnError: true);
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 }
61 62
62 // ignore: use_setters_to_change_properties 63 // ignore: use_setters_to_change_properties
63 void onOpen(OpenSocket fn) { 64 void onOpen(OpenSocket fn) {
64 - socketNotifier.open = fn; 65 + socketNotifier!.open = fn;
65 } 66 }
66 67
67 void onClose(CloseSocket fn) { 68 void onClose(CloseSocket fn) {
68 - socketNotifier.addCloses(fn); 69 + socketNotifier!.addCloses(fn);
69 } 70 }
70 71
71 void onError(CloseSocket fn) { 72 void onError(CloseSocket fn) {
72 - socketNotifier.addErrors(fn); 73 + socketNotifier!.addErrors(fn);
73 } 74 }
74 75
75 void onMessage(MessageSocket fn) { 76 void onMessage(MessageSocket fn) {
76 - socketNotifier.addMessages(fn); 77 + socketNotifier!.addMessages(fn);
77 } 78 }
78 79
79 void on(String event, MessageSocket message) { 80 void on(String event, MessageSocket message) {
80 - socketNotifier.addEvents(event, message); 81 + socketNotifier!.addEvents(event, message);
81 } 82 }
82 83
83 - void close([int status, String reason]) { 84 + void close([int? status, String? reason]) {
84 if (socket != null) { 85 if (socket != null) {
85 - socket.close(status, reason); 86 + socket!.close(status, reason);
86 } 87 }
87 } 88 }
88 89
@@ -92,12 +93,12 @@ class BaseWebSocket { @@ -92,12 +93,12 @@ class BaseWebSocket {
92 } 93 }
93 94
94 if (socket != null) { 95 if (socket != null) {
95 - socket.add(data); 96 + socket!.add(data);
96 } 97 }
97 } 98 }
98 99
99 void dispose() { 100 void dispose() {
100 - socketNotifier.dispose(); 101 + socketNotifier!.dispose();
101 socketNotifier = null; 102 socketNotifier = null;
102 isDisposed = true; 103 isDisposed = true;
103 } 104 }
@@ -36,7 +36,7 @@ class BaseWebSocket { @@ -36,7 +36,7 @@ class BaseWebSocket {
36 throw 'To use sockets you need dart:io or dart:html'; 36 throw 'To use sockets you need dart:io or dart:html';
37 } 37 }
38 38
39 - void close([int status, String reason]) { 39 + void close([int? status, String? reason]) {
40 throw 'To use sockets you need dart:io or dart:html'; 40 throw 'To use sockets you need dart:io or dart:html';
41 } 41 }
42 42
@@ -5,7 +5,7 @@ import 'smart_management.dart'; @@ -5,7 +5,7 @@ import 'smart_management.dart';
5 /// class through extensions 5 /// class through extensions
6 abstract class GetInterface { 6 abstract class GetInterface {
7 SmartManagement smartManagement = SmartManagement.full; 7 SmartManagement smartManagement = SmartManagement.full;
8 - String reference; 8 + String? reference;
9 bool isLogEnable = true; 9 bool isLogEnable = true;
10 LogWriterCallback log = defaultLogWriterCallback; 10 LogWriterCallback log = defaultLogWriterCallback;
11 } 11 }
@@ -42,7 +42,7 @@ class BindingsBuilder<T> extends Bindings { @@ -42,7 +42,7 @@ class BindingsBuilder<T> extends Bindings {
42 /// ), 42 /// ),
43 /// ``` 43 /// ```
44 factory BindingsBuilder.put(InstanceBuilderCallback<T> builder, 44 factory BindingsBuilder.put(InstanceBuilderCallback<T> builder,
45 - {String tag, bool permanent = false}) { 45 + {String? tag, bool permanent = false}) {
46 return BindingsBuilder( 46 return BindingsBuilder(
47 () => GetInstance().put<T>(builder(), tag: tag, permanent: permanent)); 47 () => GetInstance().put<T>(builder(), tag: tag, permanent: permanent));
48 } 48 }
@@ -28,7 +28,7 @@ extension Inst on GetInterface { @@ -28,7 +28,7 @@ extension Inst on GetInterface {
28 /// Subsequent calls to [Get.lazyPut()] with the same parameters 28 /// Subsequent calls to [Get.lazyPut()] with the same parameters
29 /// (<[S]> and optionally [tag] will **not** override the original). 29 /// (<[S]> and optionally [tag] will **not** override the original).
30 void lazyPut<S>(InstanceBuilderCallback<S> builder, 30 void lazyPut<S>(InstanceBuilderCallback<S> builder,
31 - {String tag, bool fenix = false}) { 31 + {String? tag, bool fenix = false}) {
32 GetInstance().lazyPut<S>(builder, tag: tag, fenix: fenix); 32 GetInstance().lazyPut<S>(builder, tag: tag, fenix: fenix);
33 } 33 }
34 34
@@ -40,7 +40,7 @@ extension Inst on GetInterface { @@ -40,7 +40,7 @@ extension Inst on GetInterface {
40 /// Awaits for the resolution of the Future from [builder()] parameter and 40 /// Awaits for the resolution of the Future from [builder()] parameter and
41 /// stores the Instance returned. 41 /// stores the Instance returned.
42 Future<S> putAsync<S>(AsyncInstanceBuilderCallback<S> builder, 42 Future<S> putAsync<S>(AsyncInstanceBuilderCallback<S> builder,
43 - {String tag, bool permanent = false}) async => 43 + {String? tag, bool permanent = false}) async =>
44 GetInstance().putAsync<S>(builder, tag: tag, permanent: permanent); 44 GetInstance().putAsync<S>(builder, tag: tag, permanent: permanent);
45 45
46 /// Creates a new Class Instance [S] from the builder callback[S]. 46 /// Creates a new Class Instance [S] from the builder callback[S].
@@ -61,13 +61,13 @@ extension Inst on GetInterface { @@ -61,13 +61,13 @@ extension Inst on GetInterface {
61 /// Repl b = find(); 61 /// Repl b = find();
62 /// print(a==b); (false)``` 62 /// print(a==b); (false)```
63 void create<S>(InstanceBuilderCallback<S> builder, 63 void create<S>(InstanceBuilderCallback<S> builder,
64 - {String tag, bool permanent = true}) => 64 + {String? tag, bool permanent = true}) =>
65 GetInstance().create<S>(builder, tag: tag, permanent: permanent); 65 GetInstance().create<S>(builder, tag: tag, permanent: permanent);
66 66
67 /// Finds a Instance of the required Class <[S]>(or [tag]) 67 /// Finds a Instance of the required Class <[S]>(or [tag])
68 /// In the case of using [Get.create()], it will generate an Instance 68 /// In the case of using [Get.create()], it will generate an Instance
69 /// each time you call [Get.find()]. 69 /// each time you call [Get.find()].
70 - S find<S>({String tag}) => GetInstance().find<S>(tag: tag); 70 + S find<S>({String? tag}) => GetInstance().find<S>(tag: tag);
71 71
72 /// Injects an [Instance<S>] in memory. 72 /// Injects an [Instance<S>] in memory.
73 /// 73 ///
@@ -84,9 +84,9 @@ extension Inst on GetInterface { @@ -84,9 +84,9 @@ extension Inst on GetInterface {
84 /// and [Get.delete()] 84 /// and [Get.delete()]
85 /// - [builder] If defined, the [dependency] must be returned from here 85 /// - [builder] If defined, the [dependency] must be returned from here
86 S put<S>(S dependency, 86 S put<S>(S dependency,
87 - {String tag, 87 + {String? tag,
88 bool permanent = false, 88 bool permanent = false,
89 - InstanceBuilderCallback<S> builder}) => 89 + InstanceBuilderCallback<S>? builder}) =>
90 GetInstance().put<S>(dependency, tag: tag, permanent: permanent); 90 GetInstance().put<S>(dependency, tag: tag, permanent: permanent);
91 91
92 /// Clears all registered instances (and/or tags). 92 /// Clears all registered instances (and/or tags).
@@ -104,15 +104,16 @@ extension Inst on GetInterface { @@ -104,15 +104,16 @@ extension Inst on GetInterface {
104 /// 104 ///
105 /// - [tag] Optional "tag" used to register the Instance 105 /// - [tag] Optional "tag" used to register the Instance
106 /// - [force] Will delete an Instance even if marked as [permanent]. 106 /// - [force] Will delete an Instance even if marked as [permanent].
107 - Future<bool> delete<S>({String tag, bool force = false}) async => 107 + Future<bool> delete<S>({String? tag, bool force = false}) async =>
108 GetInstance().delete<S>(tag: tag, force: force); 108 GetInstance().delete<S>(tag: tag, force: force);
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.
116 /// - [tag] optional, if you use a [tag] to register the Instance. 117 /// - [tag] optional, if you use a [tag] to register the Instance.
117 - bool isPrepared<S>({String tag}) => GetInstance().isPrepared<S>(tag: tag); 118 + bool isPrepared<S>({String? tag}) => GetInstance().isPrepared<S>(tag: tag);
118 } 119 }
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';
9 7
10 class InstanceInfo { 8 class InstanceInfo {
11 - final bool isPermanent;  
12 - final bool isSingleton;  
13 - bool get isCreate => !isSingleton; 9 + final bool? isPermanent;
  10 + final bool? isSingleton;
  11 + bool get isCreate => !isSingleton!;
14 final bool isRegistered; 12 final bool isRegistered;
15 final bool isPrepared; 13 final bool isPrepared;
16 - final bool isInit; 14 + final bool? isInit;
17 const InstanceInfo({ 15 const InstanceInfo({
18 - @required this.isPermanent,  
19 - @required this.isSingleton,  
20 - @required this.isRegistered,  
21 - @required this.isPrepared,  
22 - @required this.isInit, 16 + required this.isPermanent,
  17 + required this.isSingleton,
  18 + required this.isRegistered,
  19 + required this.isPrepared,
  20 + required this.isInit,
23 }); 21 });
24 } 22 }
25 23
@@ -28,7 +26,7 @@ class GetInstance { @@ -28,7 +26,7 @@ class GetInstance {
28 26
29 const GetInstance._(); 27 const GetInstance._();
30 28
31 - static GetInstance _getInstance; 29 + static GetInstance? _getInstance;
32 30
33 T call<T>() => find<T>(); 31 T call<T>() => find<T>();
34 32
@@ -42,13 +40,13 @@ class GetInstance { @@ -42,13 +40,13 @@ class GetInstance {
42 40
43 /// Holds a reference to [Get.reference] when the Instance was 41 /// Holds a reference to [Get.reference] when the Instance was
44 /// created to manage the memory. 42 /// created to manage the memory.
45 - static final Map<String, String> _routesKey = {}; 43 + static final Map<String, String?> _routesKey = {};
46 44
47 /// Stores the onClose() references of instances created with [Get.create()] 45 /// Stores the onClose() references of instances created with [Get.create()]
48 /// using the [Get.reference]. 46 /// using the [Get.reference].
49 /// Experimental feature to keep the lifecycle and memory management with 47 /// Experimental feature to keep the lifecycle and memory management with
50 /// non-singleton instances. 48 /// non-singleton instances.
51 - static final Map<String, HashSet<Function>> _routesByCreate = {}; 49 + static final Map<String?, HashSet<Function>> _routesByCreate = {};
52 50
53 void printInstanceStack() { 51 void printInstanceStack() {
54 Get.log(_routesKey.toString()); 52 Get.log(_routesKey.toString());
@@ -56,7 +54,7 @@ class GetInstance { @@ -56,7 +54,7 @@ class GetInstance {
56 54
57 void injector<S>( 55 void injector<S>(
58 InjectorBuilderCallback<S> fn, { 56 InjectorBuilderCallback<S> fn, {
59 - String tag, 57 + String? tag,
60 bool fenix = false, 58 bool fenix = false,
61 // bool permanent = false, 59 // bool permanent = false,
62 }) { 60 }) {
@@ -73,7 +71,7 @@ class GetInstance { @@ -73,7 +71,7 @@ class GetInstance {
73 /// stores the Instance returned. 71 /// stores the Instance returned.
74 Future<S> putAsync<S>( 72 Future<S> putAsync<S>(
75 AsyncInstanceBuilderCallback<S> builder, { 73 AsyncInstanceBuilderCallback<S> builder, {
76 - String tag, 74 + String? tag,
77 bool permanent = false, 75 bool permanent = false,
78 }) async { 76 }) async {
79 return put<S>(await builder(), tag: tag, permanent: permanent); 77 return put<S>(await builder(), tag: tag, permanent: permanent);
@@ -91,9 +89,9 @@ class GetInstance { @@ -91,9 +89,9 @@ class GetInstance {
91 /// [Get.smartManagement] rules. 89 /// [Get.smartManagement] rules.
92 S put<S>( 90 S put<S>(
93 S dependency, { 91 S dependency, {
94 - String tag, 92 + String? tag,
95 bool permanent = false, 93 bool permanent = false,
96 - @deprecated InstanceBuilderCallback<S> builder, 94 + @deprecated InstanceBuilderCallback<S>? builder,
97 }) { 95 }) {
98 _insert( 96 _insert(
99 isSingleton: true, 97 isSingleton: true,
@@ -127,8 +125,8 @@ class GetInstance { @@ -127,8 +125,8 @@ class GetInstance {
127 /// (<[S]> and optionally [tag] will **not** override the original). 125 /// (<[S]> and optionally [tag] will **not** override the original).
128 void lazyPut<S>( 126 void lazyPut<S>(
129 InstanceBuilderCallback<S> builder, { 127 InstanceBuilderCallback<S> builder, {
130 - String tag,  
131 - bool fenix, 128 + String? tag,
  129 + bool? fenix,
132 bool permanent = false, 130 bool permanent = false,
133 }) { 131 }) {
134 _insert( 132 _insert(
@@ -158,7 +156,7 @@ class GetInstance { @@ -158,7 +156,7 @@ class GetInstance {
158 /// print(a==b); (false)``` 156 /// print(a==b); (false)```
159 void create<S>( 157 void create<S>(
160 InstanceBuilderCallback<S> builder, { 158 InstanceBuilderCallback<S> builder, {
161 - String tag, 159 + String? tag,
162 bool permanent = true, 160 bool permanent = true,
163 }) { 161 }) {
164 _insert( 162 _insert(
@@ -171,13 +169,12 @@ class GetInstance { @@ -171,13 +169,12 @@ class GetInstance {
171 169
172 /// Injects the Instance [S] builder into the [_singleton] HashMap. 170 /// Injects the Instance [S] builder into the [_singleton] HashMap.
173 void _insert<S>({ 171 void _insert<S>({
174 - bool isSingleton,  
175 - String name, 172 + bool? isSingleton,
  173 + String? name,
176 bool permanent = false, 174 bool permanent = false,
177 - 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,
@@ -206,14 +203,12 @@ class GetInstance { @@ -206,14 +203,12 @@ class GetInstance {
206 203
207 /// Removes [Get.create()] instances registered in [routeName]. 204 /// Removes [Get.create()] instances registered in [routeName].
208 if (_routesByCreate.containsKey(routeName)) { 205 if (_routesByCreate.containsKey(routeName)) {
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(); 209 onClose();
214 } 210 }
215 - }  
216 - _routesByCreate[routeName].clear(); 211 + _routesByCreate[routeName]!.clear();
217 _routesByCreate.remove(routeName); 212 _routesByCreate.remove(routeName);
218 } 213 }
219 214
@@ -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 }
@@ -236,14 +231,14 @@ class GetInstance { @@ -236,14 +231,14 @@ class GetInstance {
236 /// (not for Singletons access). 231 /// (not for Singletons access).
237 /// Returns the instance if not initialized, required for Get.create() to 232 /// Returns the instance if not initialized, required for Get.create() to
238 /// work properly. 233 /// work properly.
239 - S _initDependencies<S>({String name}) { 234 + S? _initDependencies<S>({String? name}) {
240 final key = _getKey(S, name); 235 final key = _getKey(S, name);
241 - final isInit = _singl[key].isInit;  
242 - S i; 236 + final isInit = _singl[key]!.isInit;
  237 + S? i;
243 if (!isInit) { 238 if (!isInit) {
244 i = _startController<S>(tag: name); 239 i = _startController<S>(tag: name);
245 - if (_singl[key].isSingleton) {  
246 - _singl[key].isInit = true; 240 + if (_singl[key]!.isSingleton!) {
  241 + _singl[key]!.isInit = true;
247 if (Get.smartManagement != SmartManagement.onlyBuilder) { 242 if (Get.smartManagement != SmartManagement.onlyBuilder) {
248 _registerRouteInstance<S>(tag: name); 243 _registerRouteInstance<S>(tag: name);
249 } 244 }
@@ -254,11 +249,11 @@ class GetInstance { @@ -254,11 +249,11 @@ class GetInstance {
254 249
255 /// Links a Class instance [S] (or [tag]) to the current route. 250 /// Links a Class instance [S] (or [tag]) to the current route.
256 /// Requires usage of [GetMaterialApp]. 251 /// Requires usage of [GetMaterialApp].
257 - void _registerRouteInstance<S>({String tag}) { 252 + void _registerRouteInstance<S>({String? tag}) {
258 _routesKey.putIfAbsent(_getKey(S, tag), () => Get.reference); 253 _routesKey.putIfAbsent(_getKey(S, tag), () => Get.reference);
259 } 254 }
260 255
261 - InstanceInfo getInstanceInfo<S>({String tag}) { 256 + InstanceInfo getInstanceInfo<S>({String? tag}) {
262 final build = _getDependency<S>(tag: tag); 257 final build = _getDependency<S>(tag: tag);
263 258
264 return InstanceInfo( 259 return InstanceInfo(
@@ -270,7 +265,7 @@ class GetInstance { @@ -270,7 +265,7 @@ class GetInstance {
270 ); 265 );
271 } 266 }
272 267
273 - _InstanceBuilderFactory _getDependency<S>({String tag, String key}) { 268 + _InstanceBuilderFactory? _getDependency<S>({String? tag, String? key}) {
274 final newKey = key ?? _getKey(S, tag); 269 final newKey = key ?? _getKey(S, tag);
275 270
276 if (!_singl.containsKey(newKey)) { 271 if (!_singl.containsKey(newKey)) {
@@ -282,31 +277,30 @@ class GetInstance { @@ -282,31 +277,30 @@ class GetInstance {
282 } 277 }
283 278
284 /// Initializes the controller 279 /// Initializes the controller
285 - S _startController<S>({String tag}) { 280 + S _startController<S>({String? tag}) {
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(); 284 i.onStart();
291 if (tag == null) { 285 if (tag == null) {
292 Get.log('Instance "$S" has been initialized'); 286 Get.log('Instance "$S" has been initialized');
293 } else { 287 } else {
294 Get.log('Instance "$S" with tag "$tag" has been initialized'); 288 Get.log('Instance "$S" with tag "$tag" has been initialized');
295 } 289 }
296 - }  
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); 292 + // _routesByCreate[Get.reference]!.add(i.onDelete as Function);
  293 + _routesByCreate[Get.reference]!.add(i.onDelete);
300 } 294 }
301 } 295 }
302 return i; 296 return i;
303 } 297 }
304 298
305 - S putOrFind<S>(InstanceBuilderCallback<S> dep, {String tag}) { 299 + S putOrFind<S>(InstanceBuilderCallback<S> dep, {String? tag}) {
306 final key = _getKey(S, tag); 300 final key = _getKey(S, tag);
307 301
308 if (_singl.containsKey(key)) { 302 if (_singl.containsKey(key)) {
309 - return _singl[key].getDependency() as S; 303 + return _singl[key]!.getDependency() as S;
310 } else { 304 } else {
311 return GetInstance().put(dep(), tag: tag); 305 return GetInstance().put(dep(), tag: tag);
312 } 306 }
@@ -317,7 +311,7 @@ class GetInstance { @@ -317,7 +311,7 @@ class GetInstance {
317 /// it will create an instance each time you call [find]. 311 /// it will create an instance each time you call [find].
318 /// If the registered type <[S]> (or [tag]) is a Controller, 312 /// If the registered type <[S]> (or [tag]) is a Controller,
319 /// it will initialize it's lifecycle. 313 /// it will initialize it's lifecycle.
320 - S find<S>({String tag}) { 314 + S find<S>({String? tag}) {
321 final key = _getKey(S, tag); 315 final key = _getKey(S, tag);
322 if (isRegistered<S>(tag: tag)) { 316 if (isRegistered<S>(tag: tag)) {
323 if (_singl[key] == null) { 317 if (_singl[key] == null) {
@@ -332,7 +326,7 @@ class GetInstance { @@ -332,7 +326,7 @@ class GetInstance {
332 /// `initDependencies`, so we have to return the instance from there 326 /// `initDependencies`, so we have to return the instance from there
333 /// to make it compatible with `Get.create()`. 327 /// to make it compatible with `Get.create()`.
334 final i = _initDependencies<S>(name: tag); 328 final i = _initDependencies<S>(name: tag);
335 - return i ?? _singl[key].getDependency() as S; 329 + return i ?? _singl[key]!.getDependency() as S;
336 } else { 330 } else {
337 // ignore: lines_longer_than_80_chars 331 // ignore: lines_longer_than_80_chars
338 throw '"$S" not found. You need to call "Get.put($S())" or "Get.lazyPut(()=>$S())"'; 332 throw '"$S" not found. You need to call "Get.put($S())" or "Get.lazyPut(()=>$S())"';
@@ -341,7 +335,7 @@ class GetInstance { @@ -341,7 +335,7 @@ class GetInstance {
341 335
342 /// Generates the key based on [type] (and optionally a [name]) 336 /// Generates the key based on [type] (and optionally a [name])
343 /// to register an Instance Builder in the hashmap. 337 /// to register an Instance Builder in the hashmap.
344 - String _getKey(Type type, String name) { 338 + String _getKey(Type type, String? name) {
345 return name == null ? type.toString() : type.toString() + name; 339 return name == null ? type.toString() : type.toString() + name;
346 } 340 }
347 341
@@ -374,7 +368,7 @@ class GetInstance { @@ -374,7 +368,7 @@ class GetInstance {
374 /// - [key] For internal usage, is the processed key used to register 368 /// - [key] For internal usage, is the processed key used to register
375 /// the Instance. **don't use** it unless you know what you are doing. 369 /// the Instance. **don't use** it unless you know what you are doing.
376 /// - [force] Will delete an Instance even if marked as [permanent]. 370 /// - [force] Will delete an Instance even if marked as [permanent].
377 - bool delete<S>({String tag, String key, bool force = false}) { 371 + bool delete<S>({String? tag, String? key, bool force = false}) {
378 final newKey = key ?? _getKey(S, tag); 372 final newKey = key ?? _getKey(S, tag);
379 373
380 if (!_singl.containsKey(newKey)) { 374 if (!_singl.containsKey(newKey)) {
@@ -382,7 +376,7 @@ class GetInstance { @@ -382,7 +376,7 @@ class GetInstance {
382 return false; 376 return false;
383 } 377 }
384 378
385 - final builder = _singl[newKey]; 379 + final builder = _singl[newKey]!;
386 380
387 if (builder.permanent && !force) { 381 if (builder.permanent && !force) {
388 Get.log( 382 Get.log(
@@ -398,7 +392,7 @@ class GetInstance { @@ -398,7 +392,7 @@ class GetInstance {
398 return false; 392 return false;
399 } 393 }
400 394
401 - if (i is GetLifeCycleBase && i.onDelete != null) { 395 + if (i is GetLifeCycleBase) {
402 i.onDelete(); 396 i.onDelete();
403 Get.log('"$newKey" onDelete() called'); 397 Get.log('"$newKey" onDelete() called');
404 } 398 }
@@ -430,7 +424,7 @@ class GetInstance { @@ -430,7 +424,7 @@ class GetInstance {
430 }); 424 });
431 } 425 }
432 426
433 - void reload<S>({String tag, String key, bool force = false}) { 427 + void reload<S>({String? tag, String? key, bool force = false}) {
434 final newKey = key ?? _getKey(S, tag); 428 final newKey = key ?? _getKey(S, tag);
435 429
436 final builder = _getDependency<S>(tag: tag, key: newKey); 430 final builder = _getDependency<S>(tag: tag, key: newKey);
@@ -451,12 +445,12 @@ class GetInstance { @@ -451,12 +445,12 @@ class GetInstance {
451 445
452 /// Check if a Class Instance<[S]> (or [tag]) is registered in memory. 446 /// Check if a Class Instance<[S]> (or [tag]) is registered in memory.
453 /// - [tag] is optional, if you used a [tag] to register the Instance. 447 /// - [tag] is optional, if you used a [tag] to register the Instance.
454 - bool isRegistered<S>({String tag}) => _singl.containsKey(_getKey(S, tag)); 448 + bool isRegistered<S>({String? tag}) => _singl.containsKey(_getKey(S, tag));
455 449
456 /// Checks if a lazy factory callback ([Get.lazyPut()] that returns an 450 /// Checks if a lazy factory callback ([Get.lazyPut()] that returns an
457 /// Instance<[S]> is registered in memory. 451 /// Instance<[S]> is registered in memory.
458 /// - [tag] is optional, if you used a [tag] to register the lazy Instance. 452 /// - [tag] is optional, if you used a [tag] to register the lazy Instance.
459 - bool isPrepared<S>({String tag}) { 453 + bool isPrepared<S>({String? tag}) {
460 final newKey = _getKey(S, tag); 454 final newKey = _getKey(S, tag);
461 455
462 final builder = _getDependency<S>(tag: tag, key: newKey); 456 final builder = _getDependency<S>(tag: tag, key: newKey);
@@ -481,14 +475,14 @@ typedef AsyncInstanceBuilderCallback<S> = Future<S> Function(); @@ -481,14 +475,14 @@ typedef AsyncInstanceBuilderCallback<S> = Future<S> Function();
481 class _InstanceBuilderFactory<S> { 475 class _InstanceBuilderFactory<S> {
482 /// Marks the Builder as a single instance. 476 /// Marks the Builder as a single instance.
483 /// For reusing [dependency] instead of [builderFunc] 477 /// For reusing [dependency] instead of [builderFunc]
484 - bool isSingleton; 478 + bool? isSingleton;
485 479
486 /// When fenix mode is avaliable, when a new instance is need 480 /// When fenix mode is avaliable, when a new instance is need
487 /// Instance manager will recreate a new instance of S 481 /// Instance manager will recreate a new instance of S
488 bool fenix; 482 bool fenix;
489 483
490 /// Stores the actual object instance when [isSingleton]=true. 484 /// Stores the actual object instance when [isSingleton]=true.
491 - S dependency; 485 + S? dependency;
492 486
493 /// Generates (and regenerates) the instance when [isSingleton]=false. 487 /// Generates (and regenerates) the instance when [isSingleton]=false.
494 /// Usually used by factory methods 488 /// Usually used by factory methods
@@ -500,7 +494,7 @@ class _InstanceBuilderFactory<S> { @@ -500,7 +494,7 @@ class _InstanceBuilderFactory<S> {
500 494
501 bool isInit = false; 495 bool isInit = false;
502 496
503 - String tag; 497 + String? tag;
504 498
505 _InstanceBuilderFactory( 499 _InstanceBuilderFactory(
506 this.isSingleton, 500 this.isSingleton,
@@ -521,12 +515,12 @@ class _InstanceBuilderFactory<S> { @@ -521,12 +515,12 @@ class _InstanceBuilderFactory<S> {
521 515
522 /// Gets the actual instance by it's [builderFunc] or the persisted instance. 516 /// Gets the actual instance by it's [builderFunc] or the persisted instance.
523 S getDependency() { 517 S getDependency() {
524 - if (isSingleton) { 518 + if (isSingleton!) {
525 if (dependency == null) { 519 if (dependency == null) {
526 _showInitLog(); 520 _showInitLog();
527 dependency = builderFunc(); 521 dependency = builderFunc();
528 } 522 }
529 - return dependency; 523 + return dependency!;
530 } else { 524 } else {
531 return builderFunc(); 525 return builderFunc();
532 } 526 }
@@ -5,11 +5,11 @@ import '../../get_core/get_core.dart'; @@ -5,11 +5,11 @@ import '../../get_core/get_core.dart';
5 /// methods. 5 /// methods.
6 /// Used in [DisposableInterface] to avoid the danger of overriding onStart. 6 /// Used in [DisposableInterface] to avoid the danger of overriding onStart.
7 class _InternalFinalCallback<T> { 7 class _InternalFinalCallback<T> {
8 - ValueUpdater<T> _callback; 8 + ValueUpdater<T>? _callback;
9 9
10 - _InternalFinalCallback({ValueUpdater<T> callback}) : _callback = callback; 10 + _InternalFinalCallback({ValueUpdater<T>? callback}) : _callback = callback;
11 11
12 - T call() => _callback.call(); 12 + T call() => _callback!.call();
13 } 13 }
14 14
15 /// The [GetLifeCycle] 15 /// The [GetLifeCycle]
@@ -14,24 +14,21 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -14,24 +14,21 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
14 this.modalBarrierColor, 14 this.modalBarrierColor,
15 this.isDismissible = true, 15 this.isDismissible = true,
16 this.enableDrag = true, 16 this.enableDrag = true,
17 - @required this.isScrollControlled,  
18 - RouteSettings settings, 17 + required this.isScrollControlled,
  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;  
27 - final WidgetBuilder builder;  
28 - final ThemeData theme; 23 + final bool? isPersistent;
  24 + final WidgetBuilder? builder;
  25 + final ThemeData? theme;
29 final bool isScrollControlled; 26 final bool isScrollControlled;
30 - final Color backgroundColor;  
31 - final double elevation;  
32 - final ShapeBorder shape;  
33 - final Clip clipBehavior;  
34 - final Color modalBarrierColor; 27 + final Color? backgroundColor;
  28 + final double? elevation;
  29 + final ShapeBorder? shape;
  30 + final Clip? clipBehavior;
  31 + final Color? modalBarrierColor;
35 final bool isDismissible; 32 final bool isDismissible;
36 final bool enableDrag; 33 final bool enableDrag;
37 final String name; 34 final String name;
@@ -47,21 +44,21 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -47,21 +44,21 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
47 bool get barrierDismissible => isDismissible; 44 bool get barrierDismissible => isDismissible;
48 45
49 @override 46 @override
50 - final String barrierLabel; 47 + final String? barrierLabel;
51 48
52 @override 49 @override
53 Color get barrierColor => modalBarrierColor ?? Colors.black54; 50 Color get barrierColor => modalBarrierColor ?? Colors.black54;
54 51
55 - AnimationController _animationController; 52 + AnimationController? _animationController;
56 53
57 @override 54 @override
58 AnimationController createAnimationController() { 55 AnimationController createAnimationController() {
59 assert(_animationController == null); 56 assert(_animationController == null);
60 _animationController = 57 _animationController =
61 - BottomSheet.createAnimationController(navigator.overlay);  
62 - _animationController.duration = enterBottomSheetDuration;  
63 - _animationController.reverseDuration = exitBottomSheetDuration;  
64 - return _animationController; 58 + BottomSheet.createAnimationController(navigator!.overlay!);
  59 + _animationController!.duration = enterBottomSheetDuration;
  60 + _animationController!.reverseDuration = exitBottomSheetDuration;
  61 + return _animationController!;
65 } 62 }
66 63
67 @override 64 @override
@@ -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,
@@ -91,14 +88,14 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -91,14 +88,14 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
91 ), 88 ),
92 ), 89 ),
93 ); 90 );
94 - if (theme != null) bottomSheet = Theme(data: theme, child: bottomSheet); 91 + if (theme != null) bottomSheet = Theme(data: theme!, child: bottomSheet);
95 return bottomSheet; 92 return bottomSheet;
96 } 93 }
97 } 94 }
98 95
99 class _GetModalBottomSheet<T> extends StatefulWidget { 96 class _GetModalBottomSheet<T> extends StatefulWidget {
100 const _GetModalBottomSheet({ 97 const _GetModalBottomSheet({
101 - Key key, 98 + Key? key,
102 this.route, 99 this.route,
103 this.backgroundColor, 100 this.backgroundColor,
104 this.elevation, 101 this.elevation,
@@ -107,16 +104,14 @@ class _GetModalBottomSheet<T> extends StatefulWidget { @@ -107,16 +104,14 @@ 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;
116 - final Color backgroundColor;  
117 - final double elevation;  
118 - final ShapeBorder shape;  
119 - final Clip clipBehavior; 111 + final Color? backgroundColor;
  112 + final double? elevation;
  113 + final ShapeBorder? shape;
  114 + final Clip? clipBehavior;
120 final bool enableDrag; 115 final bool enableDrag;
121 116
122 @override 117 @override
@@ -142,13 +137,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { @@ -142,13 +137,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
142 final routeLabel = _getRouteLabel(localizations); 137 final routeLabel = _getRouteLabel(localizations);
143 138
144 return AnimatedBuilder( 139 return AnimatedBuilder(
145 - animation: widget.route.animation, 140 + animation: widget.route!.animation!,
146 builder: (context, child) { 141 builder: (context, child) {
147 // Disable the initial animation when accessible navigation is on so 142 // Disable the initial animation when accessible navigation is on so
148 // that the semantics are added to the tree at the correct time. 143 // that the semantics are added to the tree at the correct time.
149 final animationValue = mediaQuery.accessibleNavigation 144 final animationValue = mediaQuery.accessibleNavigation
150 ? 1.0 145 ? 1.0
151 - : widget.route.animation.value; 146 + : widget.route!.animation!.value;
152 return Semantics( 147 return Semantics(
153 scopesRoute: true, 148 scopesRoute: true,
154 namesRoute: true, 149 namesRoute: true,
@@ -160,13 +155,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { @@ -160,13 +155,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
160 animationValue, widget.isScrollControlled), 155 animationValue, widget.isScrollControlled),
161 child: widget.isPersistent == false 156 child: widget.isPersistent == false
162 ? BottomSheet( 157 ? BottomSheet(
163 - animationController: widget.route._animationController, 158 + animationController: widget.route!._animationController,
164 onClosing: () { 159 onClosing: () {
165 - if (widget.route.isCurrent) { 160 + if (widget.route!.isCurrent) {
166 Navigator.pop(context); 161 Navigator.pop(context);
167 } 162 }
168 }, 163 },
169 - builder: widget.route.builder, 164 + builder: widget.route!.builder!,
170 backgroundColor: widget.backgroundColor, 165 backgroundColor: widget.backgroundColor,
171 elevation: widget.elevation, 166 elevation: widget.elevation,
172 shape: widget.shape, 167 shape: widget.shape,
@@ -176,13 +171,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { @@ -176,13 +171,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
176 : Scaffold( 171 : Scaffold(
177 bottomSheet: BottomSheet( 172 bottomSheet: BottomSheet(
178 animationController: 173 animationController:
179 - widget.route._animationController, 174 + widget.route!._animationController,
180 onClosing: () { 175 onClosing: () {
181 // if (widget.route.isCurrent) { 176 // if (widget.route.isCurrent) {
182 // Navigator.pop(context); 177 // Navigator.pop(context);
183 // } 178 // }
184 }, 179 },
185 - builder: widget.route.builder, 180 + builder: widget.route!.builder!,
186 backgroundColor: widget.backgroundColor, 181 backgroundColor: widget.backgroundColor,
187 elevation: widget.elevation, 182 elevation: widget.elevation,
188 shape: widget.shape, 183 shape: widget.shape,
@@ -199,7 +194,7 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { @@ -199,7 +194,7 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
199 194
200 class _GetPerModalBottomSheet<T> extends StatefulWidget { 195 class _GetPerModalBottomSheet<T> extends StatefulWidget {
201 const _GetPerModalBottomSheet({ 196 const _GetPerModalBottomSheet({
202 - Key key, 197 + Key? key,
203 this.route, 198 this.route,
204 this.isPersistent, 199 this.isPersistent,
205 this.backgroundColor, 200 this.backgroundColor,
@@ -208,16 +203,14 @@ class _GetPerModalBottomSheet<T> extends StatefulWidget { @@ -208,16 +203,14 @@ 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);  
214 - final bool isPersistent;  
215 - final GetModalBottomSheetRoute<T> route; 206 + }) : super(key: key);
  207 + final bool? isPersistent;
  208 + final GetModalBottomSheetRoute<T>? route;
216 final bool isScrollControlled; 209 final bool isScrollControlled;
217 - final Color backgroundColor;  
218 - final double elevation;  
219 - final ShapeBorder shape;  
220 - final Clip clipBehavior; 210 + final Color? backgroundColor;
  211 + final double? elevation;
  212 + final ShapeBorder? shape;
  213 + final Clip? clipBehavior;
221 final bool enableDrag; 214 final bool enableDrag;
222 215
223 @override 216 @override
@@ -247,13 +240,13 @@ class _GetPerModalBottomSheetState<T> @@ -247,13 +240,13 @@ class _GetPerModalBottomSheetState<T>
247 final routeLabel = _getRouteLabel(localizations); 240 final routeLabel = _getRouteLabel(localizations);
248 241
249 return AnimatedBuilder( 242 return AnimatedBuilder(
250 - animation: widget.route.animation, 243 + animation: widget.route!.animation!,
251 builder: (context, child) { 244 builder: (context, child) {
252 // Disable the initial animation when accessible navigation is on so 245 // Disable the initial animation when accessible navigation is on so
253 // that the semantics are added to the tree at the correct time. 246 // that the semantics are added to the tree at the correct time.
254 final animationValue = mediaQuery.accessibleNavigation 247 final animationValue = mediaQuery.accessibleNavigation
255 ? 1.0 248 ? 1.0
256 - : widget.route.animation.value; 249 + : widget.route!.animation!.value;
257 return Semantics( 250 return Semantics(
258 scopesRoute: true, 251 scopesRoute: true,
259 namesRoute: true, 252 namesRoute: true,
@@ -265,13 +258,13 @@ class _GetPerModalBottomSheetState<T> @@ -265,13 +258,13 @@ class _GetPerModalBottomSheetState<T>
265 animationValue, widget.isScrollControlled), 258 animationValue, widget.isScrollControlled),
266 child: widget.isPersistent == false 259 child: widget.isPersistent == false
267 ? BottomSheet( 260 ? BottomSheet(
268 - animationController: widget.route._animationController, 261 + animationController: widget.route!._animationController,
269 onClosing: () { 262 onClosing: () {
270 - if (widget.route.isCurrent) { 263 + if (widget.route!.isCurrent) {
271 Navigator.pop(context); 264 Navigator.pop(context);
272 } 265 }
273 }, 266 },
274 - builder: widget.route.builder, 267 + builder: widget.route!.builder!,
275 backgroundColor: widget.backgroundColor, 268 backgroundColor: widget.backgroundColor,
276 elevation: widget.elevation, 269 elevation: widget.elevation,
277 shape: widget.shape, 270 shape: widget.shape,
@@ -281,13 +274,13 @@ class _GetPerModalBottomSheetState<T> @@ -281,13 +274,13 @@ class _GetPerModalBottomSheetState<T>
281 : Scaffold( 274 : Scaffold(
282 bottomSheet: BottomSheet( 275 bottomSheet: BottomSheet(
283 animationController: 276 animationController:
284 - widget.route._animationController, 277 + widget.route!._animationController,
285 onClosing: () { 278 onClosing: () {
286 // if (widget.route.isCurrent) { 279 // if (widget.route.isCurrent) {
287 // Navigator.pop(context); 280 // Navigator.pop(context);
288 // } 281 // }
289 }, 282 },
290 - builder: widget.route.builder, 283 + builder: widget.route!.builder!,
291 backgroundColor: widget.backgroundColor, 284 backgroundColor: widget.backgroundColor,
292 elevation: widget.elevation, 285 elevation: widget.elevation,
293 shape: widget.shape, 286 shape: widget.shape,
@@ -4,15 +4,14 @@ import '../../../get_instance/src/get_instance.dart'; @@ -4,15 +4,14 @@ import '../../../get_instance/src/get_instance.dart';
4 4
5 class GetDialogRoute<T> extends PopupRoute<T> { 5 class GetDialogRoute<T> extends PopupRoute<T> {
6 GetDialogRoute({ 6 GetDialogRoute({
7 - @required RoutePageBuilder pageBuilder, 7 + required RoutePageBuilder pageBuilder,
8 bool barrierDismissible = true, 8 bool barrierDismissible = true,
9 - String barrierLabel, 9 + String? barrierLabel,
10 Color barrierColor = const Color(0x80000000), 10 Color barrierColor = const Color(0x80000000),
11 Duration transitionDuration = const Duration(milliseconds: 200), 11 Duration transitionDuration = const Duration(milliseconds: 200),
12 - RouteTransitionsBuilder transitionBuilder,  
13 - RouteSettings settings,  
14 - }) : assert(barrierDismissible != null),  
15 - widget = pageBuilder, 12 + RouteTransitionsBuilder? transitionBuilder,
  13 + RouteSettings? settings,
  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,
@@ -32,15 +31,15 @@ class GetDialogRoute<T> extends PopupRoute<T> { @@ -32,15 +31,15 @@ class GetDialogRoute<T> extends PopupRoute<T> {
32 @override 31 @override
33 void dispose() { 32 void dispose() {
34 if (Get.smartManagement != SmartManagement.onlyBuilder) { 33 if (Get.smartManagement != SmartManagement.onlyBuilder) {
35 - WidgetsBinding.instance.addPostFrameCallback( 34 + WidgetsBinding.instance!.addPostFrameCallback(
36 (_) => GetInstance().removeDependencyByRoute(name)); 35 (_) => GetInstance().removeDependencyByRoute(name));
37 } 36 }
38 super.dispose(); 37 super.dispose();
39 } 38 }
40 39
41 @override 40 @override
42 - String get barrierLabel => _barrierLabel;  
43 - final String _barrierLabel; 41 + String? get barrierLabel => _barrierLabel;
  42 + final String? _barrierLabel;
44 43
45 @override 44 @override
46 Color get barrierColor => _barrierColor; 45 Color get barrierColor => _barrierColor;
@@ -50,7 +49,7 @@ class GetDialogRoute<T> extends PopupRoute<T> { @@ -50,7 +49,7 @@ class GetDialogRoute<T> extends PopupRoute<T> {
50 Duration get transitionDuration => _transitionDuration; 49 Duration get transitionDuration => _transitionDuration;
51 final Duration _transitionDuration; 50 final Duration _transitionDuration;
52 51
53 - final RouteTransitionsBuilder _transitionBuilder; 52 + final RouteTransitionsBuilder? _transitionBuilder;
54 53
55 @override 54 @override
56 Widget buildPage(BuildContext context, Animation<double> animation, 55 Widget buildPage(BuildContext context, Animation<double> animation,
@@ -73,6 +72,6 @@ class GetDialogRoute<T> extends PopupRoute<T> { @@ -73,6 +72,6 @@ class GetDialogRoute<T> extends PopupRoute<T> {
73 ), 72 ),
74 child: child); 73 child: child);
75 } // Some default transition 74 } // Some default transition
76 - return _transitionBuilder(context, animation, secondaryAnimation, child); 75 + return _transitionBuilder!(context, animation, secondaryAnimation, child);
77 } 76 }
78 } 77 }
@@ -14,42 +14,42 @@ import 'routes/transitions_type.dart'; @@ -14,42 +14,42 @@ import 'routes/transitions_type.dart';
14 14
15 extension ExtensionSnackbar on GetInterface { 15 extension ExtensionSnackbar on GetInterface {
16 void rawSnackbar({ 16 void rawSnackbar({
17 - String title,  
18 - String message,  
19 - Widget titleText,  
20 - Widget messageText,  
21 - Widget icon, 17 + String? title,
  18 + String? message,
  19 + Widget? titleText,
  20 + Widget? messageText,
  21 + Widget? icon,
22 bool instantInit = true, 22 bool instantInit = true,
23 bool shouldIconPulse = true, 23 bool shouldIconPulse = true,
24 - double maxWidth, 24 + double? maxWidth,
25 EdgeInsets margin = const EdgeInsets.all(0.0), 25 EdgeInsets margin = const EdgeInsets.all(0.0),
26 EdgeInsets padding = const EdgeInsets.all(16), 26 EdgeInsets padding = const EdgeInsets.all(16),
27 double borderRadius = 0.0, 27 double borderRadius = 0.0,
28 - Color borderColor, 28 + Color? borderColor,
29 double borderWidth = 1.0, 29 double borderWidth = 1.0,
30 Color backgroundColor = const Color(0xFF303030), 30 Color backgroundColor = const Color(0xFF303030),
31 - Color leftBarIndicatorColor,  
32 - List<BoxShadow> boxShadows,  
33 - Gradient backgroundGradient,  
34 - Widget mainButton,  
35 - OnTap onTap, 31 + Color? leftBarIndicatorColor,
  32 + List<BoxShadow>? boxShadows,
  33 + Gradient? backgroundGradient,
  34 + Widget? mainButton,
  35 + OnTap? onTap,
36 Duration duration = const Duration(seconds: 3), 36 Duration duration = const Duration(seconds: 3),
37 bool isDismissible = true, 37 bool isDismissible = true,
38 SnackDismissDirection dismissDirection = SnackDismissDirection.VERTICAL, 38 SnackDismissDirection dismissDirection = SnackDismissDirection.VERTICAL,
39 bool showProgressIndicator = false, 39 bool showProgressIndicator = false,
40 - AnimationController progressIndicatorController,  
41 - Color progressIndicatorBackgroundColor,  
42 - Animation<Color> progressIndicatorValueColor, 40 + AnimationController? progressIndicatorController,
  41 + Color? progressIndicatorBackgroundColor,
  42 + Animation<Color>? progressIndicatorValueColor,
43 SnackPosition snackPosition = SnackPosition.BOTTOM, 43 SnackPosition snackPosition = SnackPosition.BOTTOM,
44 SnackStyle snackStyle = SnackStyle.FLOATING, 44 SnackStyle snackStyle = SnackStyle.FLOATING,
45 Curve forwardAnimationCurve = Curves.easeOutCirc, 45 Curve forwardAnimationCurve = Curves.easeOutCirc,
46 Curve reverseAnimationCurve = Curves.easeOutCirc, 46 Curve reverseAnimationCurve = Curves.easeOutCirc,
47 Duration animationDuration = const Duration(seconds: 1), 47 Duration animationDuration = const Duration(seconds: 1),
48 - SnackbarStatusCallback snackbarStatus,  
49 - double barBlur = 0.0, 48 + SnackbarStatusCallback? snackbarStatus,
  49 + double? barBlur = 0.0,
50 double overlayBlur = 0.0, 50 double overlayBlur = 0.0,
51 - Color overlayColor,  
52 - Form userInputForm, 51 + Color? overlayColor,
  52 + Form? userInputForm,
53 }) async { 53 }) async {
54 final getBar = GetBar( 54 final getBar = GetBar(
55 snackbarStatus: snackbarStatus, 55 snackbarStatus: snackbarStatus,
@@ -76,7 +76,7 @@ extension ExtensionSnackbar on GetInterface { @@ -76,7 +76,7 @@ extension ExtensionSnackbar on GetInterface {
76 onTap: onTap, 76 onTap: onTap,
77 isDismissible: isDismissible, 77 isDismissible: isDismissible,
78 dismissDirection: dismissDirection, 78 dismissDirection: dismissDirection,
79 - showProgressIndicator: showProgressIndicator ?? false, 79 + showProgressIndicator: showProgressIndicator,
80 progressIndicatorController: progressIndicatorController, 80 progressIndicatorController: progressIndicatorController,
81 progressIndicatorBackgroundColor: progressIndicatorBackgroundColor, 81 progressIndicatorBackgroundColor: progressIndicatorBackgroundColor,
82 progressIndicatorValueColor: progressIndicatorValueColor, 82 progressIndicatorValueColor: progressIndicatorValueColor,
@@ -92,62 +92,60 @@ extension ExtensionSnackbar on GetInterface { @@ -92,62 +92,60 @@ extension ExtensionSnackbar on GetInterface {
92 if (instantInit) { 92 if (instantInit) {
93 getBar.show(); 93 getBar.show();
94 } else { 94 } else {
95 - SchedulerBinding.instance.addPostFrameCallback((_) { 95 + SchedulerBinding.instance!.addPostFrameCallback((_) {
96 getBar.show(); 96 getBar.show();
97 }); 97 });
98 } 98 }
99 } 99 }
100 100
101 - Future<T> showSnackbar<T>(GetBar snackbar) { 101 + Future<T?>? showSnackbar<T>(GetBar snackbar) {
102 return key?.currentState?.push(SnackRoute<T>(snack: snackbar)); 102 return key?.currentState?.push(SnackRoute<T>(snack: snackbar));
103 } 103 }
104 104
105 void snackbar<T>( 105 void snackbar<T>(
106 String title, 106 String title,
107 String message, { 107 String message, {
108 - Color colorText,  
109 - Duration duration, 108 + Color? colorText,
  109 + Duration? duration,
110 110
111 /// with instantInit = false you can put snackbar on initState 111 /// with instantInit = false you can put snackbar on initState
112 bool instantInit = true, 112 bool instantInit = true,
113 - SnackPosition snackPosition,  
114 - Widget titleText,  
115 - Widget messageText,  
116 - Widget icon,  
117 - bool shouldIconPulse,  
118 - double maxWidth,  
119 - EdgeInsets margin,  
120 - EdgeInsets padding,  
121 - double borderRadius,  
122 - Color borderColor,  
123 - double borderWidth,  
124 - Color backgroundColor,  
125 - Color leftBarIndicatorColor,  
126 - List<BoxShadow> boxShadows,  
127 - Gradient backgroundGradient,  
128 - TextButton mainButton,  
129 - OnTap onTap,  
130 - bool isDismissible,  
131 - bool showProgressIndicator,  
132 - SnackDismissDirection dismissDirection,  
133 - AnimationController progressIndicatorController,  
134 - Color progressIndicatorBackgroundColor,  
135 - Animation<Color> progressIndicatorValueColor,  
136 - SnackStyle snackStyle,  
137 - Curve forwardAnimationCurve,  
138 - Curve reverseAnimationCurve,  
139 - Duration animationDuration,  
140 - double barBlur,  
141 - double overlayBlur,  
142 - SnackbarStatusCallback snackbarStatus,  
143 - Color overlayColor,  
144 - Form userInputForm, 113 + SnackPosition? snackPosition,
  114 + Widget? titleText,
  115 + Widget? messageText,
  116 + Widget? icon,
  117 + bool? shouldIconPulse,
  118 + double? maxWidth,
  119 + EdgeInsets? margin,
  120 + EdgeInsets? padding,
  121 + double? borderRadius,
  122 + Color? borderColor,
  123 + double? borderWidth,
  124 + Color? backgroundColor,
  125 + Color? leftBarIndicatorColor,
  126 + List<BoxShadow>? boxShadows,
  127 + Gradient? backgroundGradient,
  128 + TextButton? mainButton,
  129 + OnTap? onTap,
  130 + bool? isDismissible,
  131 + bool? showProgressIndicator,
  132 + SnackDismissDirection? dismissDirection,
  133 + AnimationController? progressIndicatorController,
  134 + Color? progressIndicatorBackgroundColor,
  135 + Animation<Color>? progressIndicatorValueColor,
  136 + SnackStyle? snackStyle,
  137 + Curve? forwardAnimationCurve,
  138 + Curve? reverseAnimationCurve,
  139 + Duration? animationDuration,
  140 + double? barBlur,
  141 + double? overlayBlur,
  142 + SnackbarStatusCallback? snackbarStatus,
  143 + Color? overlayColor,
  144 + Form? userInputForm,
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 ?? 148 + titleText: titleText ??
151 Text( 149 Text(
152 title, 150 title,
153 style: TextStyle( 151 style: TextStyle(
@@ -200,7 +198,7 @@ extension ExtensionSnackbar on GetInterface { @@ -200,7 +198,7 @@ extension ExtensionSnackbar on GetInterface {
200 showSnackbar<T>(getBar); 198 showSnackbar<T>(getBar);
201 } else { 199 } else {
202 routing.isSnackbar = true; 200 routing.isSnackbar = true;
203 - SchedulerBinding.instance.addPostFrameCallback((_) { 201 + SchedulerBinding.instance!.addPostFrameCallback((_) {
204 showSnackbar<T>(getBar); 202 showSnackbar<T>(getBar);
205 }); 203 });
206 } 204 }
@@ -212,33 +210,27 @@ extension ExtensionDialog on GetInterface { @@ -212,33 +210,27 @@ extension ExtensionDialog on GetInterface {
212 /// You can pass a [transitionDuration] and/or [transitionCurve], 210 /// You can pass a [transitionDuration] and/or [transitionCurve],
213 /// overriding the defaults when the dialog shows up and closes. 211 /// overriding the defaults when the dialog shows up and closes.
214 /// When the dialog closes, uses those animations in reverse. 212 /// When the dialog closes, uses those animations in reverse.
215 - Future<T> dialog<T>( 213 + Future<T?> dialog<T>(
216 Widget widget, { 214 Widget widget, {
217 bool barrierDismissible = true, 215 bool barrierDismissible = true,
218 - Color barrierColor, 216 + Color? barrierColor,
219 bool useSafeArea = true, 217 bool useSafeArea = true,
220 bool useRootNavigator = true, 218 bool useRootNavigator = true,
221 - Object arguments,  
222 - Duration transitionDuration,  
223 - Curve transitionCurve,  
224 - String name,  
225 - RouteSettings routeSettings, 219 + Object? arguments,
  220 + Duration? transitionDuration,
  221 + Curve? transitionCurve,
  222 + String? name,
  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);
234 - final theme = Theme.of(context); 228 + final theme = Theme.of(context!);
235 return generalDialog<T>( 229 return generalDialog<T>(
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);
@@ -246,7 +238,7 @@ extension ExtensionDialog on GetInterface { @@ -246,7 +238,7 @@ extension ExtensionDialog on GetInterface {
246 return dialog; 238 return dialog;
247 }, 239 },
248 barrierDismissible: barrierDismissible, 240 barrierDismissible: barrierDismissible,
249 - barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, 241 + barrierLabel: MaterialLocalizations.of(context!).modalBarrierDismissLabel,
250 barrierColor: barrierColor ?? Colors.black54, 242 barrierColor: barrierColor ?? Colors.black54,
251 transitionDuration: transitionDuration ?? defaultDialogTransitionDuration, 243 transitionDuration: transitionDuration ?? defaultDialogTransitionDuration,
252 transitionBuilder: (context, animation, secondaryAnimation, child) { 244 transitionBuilder: (context, animation, secondaryAnimation, child) {
@@ -265,20 +257,18 @@ extension ExtensionDialog on GetInterface { @@ -265,20 +257,18 @@ extension ExtensionDialog on GetInterface {
265 } 257 }
266 258
267 /// Api from showGeneralDialog with no context 259 /// Api from showGeneralDialog with no context
268 - Future<T> generalDialog<T>({  
269 - @required RoutePageBuilder pageBuilder, 260 + Future<T?> generalDialog<T>({
  261 + required RoutePageBuilder pageBuilder,
270 bool barrierDismissible = false, 262 bool barrierDismissible = false,
271 - String barrierLabel, 263 + String? barrierLabel,
272 Color barrierColor = const Color(0x80000000), 264 Color barrierColor = const Color(0x80000000),
273 Duration transitionDuration = const Duration(milliseconds: 200), 265 Duration transitionDuration = const Duration(milliseconds: 200),
274 - RouteTransitionsBuilder transitionBuilder, 266 + RouteTransitionsBuilder? transitionBuilder,
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>(
283 pageBuilder: pageBuilder, 273 pageBuilder: pageBuilder,
284 barrierDismissible: barrierDismissible, 274 barrierDismissible: barrierDismissible,
@@ -291,32 +281,32 @@ extension ExtensionDialog on GetInterface { @@ -291,32 +281,32 @@ extension ExtensionDialog on GetInterface {
291 } 281 }
292 282
293 /// Custom UI Dialog. 283 /// Custom UI Dialog.
294 - Future<T> defaultDialog<T>({ 284 + Future<T?> defaultDialog<T>({
295 String title = "Alert", 285 String title = "Alert",
296 - TextStyle titleStyle,  
297 - Widget content,  
298 - VoidCallback onConfirm,  
299 - VoidCallback onCancel,  
300 - VoidCallback onCustom,  
301 - Color cancelTextColor,  
302 - Color confirmTextColor,  
303 - String textConfirm,  
304 - String textCancel,  
305 - String textCustom,  
306 - Widget confirm,  
307 - Widget cancel,  
308 - Widget custom,  
309 - Color backgroundColor, 286 + TextStyle? titleStyle,
  287 + Widget? content,
  288 + VoidCallback? onConfirm,
  289 + VoidCallback? onCancel,
  290 + VoidCallback? onCustom,
  291 + Color? cancelTextColor,
  292 + Color? confirmTextColor,
  293 + String? textConfirm,
  294 + String? textCancel,
  295 + String? textCustom,
  296 + Widget? confirm,
  297 + Widget? cancel,
  298 + Widget? custom,
  299 + Color? backgroundColor,
310 bool barrierDismissible = true, 300 bool barrierDismissible = true,
311 - Color buttonColor, 301 + Color? buttonColor,
312 String middleText = "Dialog made in 3 lines of code", 302 String middleText = "Dialog made in 3 lines of code",
313 - TextStyle middleTextStyle, 303 + TextStyle? middleTextStyle,
314 double radius = 20.0, 304 double radius = 20.0,
315 // ThemeData themeData, 305 // ThemeData themeData,
316 - List<Widget> actions, 306 + List<Widget>? actions,
317 307
318 // onWillPop Scope 308 // onWillPop Scope
319 - WillPopCallback onWillPop, 309 + WillPopCallback? onWillPop,
320 }) { 310 }) {
321 var leanCancel = onCancel != null || textCancel != null; 311 var leanCancel = onCancel != null || textCancel != null;
322 var leanConfirm = onConfirm != null || textConfirm != null; 312 var leanConfirm = onConfirm != null || textConfirm != null;
@@ -332,7 +322,7 @@ extension ExtensionDialog on GetInterface { @@ -332,7 +322,7 @@ extension ExtensionDialog on GetInterface {
332 padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), 322 padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8),
333 shape: RoundedRectangleBorder( 323 shape: RoundedRectangleBorder(
334 side: BorderSide( 324 side: BorderSide(
335 - color: buttonColor ?? theme.accentColor, 325 + color: buttonColor ?? theme!.accentColor,
336 width: 2, 326 width: 2,
337 style: BorderStyle.solid), 327 style: BorderStyle.solid),
338 borderRadius: BorderRadius.circular(100)), 328 borderRadius: BorderRadius.circular(100)),
@@ -343,7 +333,7 @@ extension ExtensionDialog on GetInterface { @@ -343,7 +333,7 @@ extension ExtensionDialog on GetInterface {
343 }, 333 },
344 child: Text( 334 child: Text(
345 textCancel ?? "Cancel", 335 textCancel ?? "Cancel",
346 - style: TextStyle(color: cancelTextColor ?? theme.accentColor), 336 + style: TextStyle(color: cancelTextColor ?? theme!.accentColor),
347 ), 337 ),
348 )); 338 ));
349 } 339 }
@@ -356,14 +346,14 @@ extension ExtensionDialog on GetInterface { @@ -356,14 +346,14 @@ extension ExtensionDialog on GetInterface {
356 style: TextButton.styleFrom( 346 style: TextButton.styleFrom(
357 tapTargetSize: MaterialTapTargetSize.shrinkWrap, 347 tapTargetSize: MaterialTapTargetSize.shrinkWrap,
358 //color: buttonColor ?? theme.accentColor, 348 //color: buttonColor ?? theme.accentColor,
359 - backgroundColor: buttonColor ?? theme.accentColor, 349 + backgroundColor: buttonColor ?? theme!.accentColor,
360 shape: RoundedRectangleBorder( 350 shape: RoundedRectangleBorder(
361 borderRadius: BorderRadius.circular(100)), 351 borderRadius: BorderRadius.circular(100)),
362 ), 352 ),
363 child: Text( 353 child: Text(
364 textConfirm ?? "Ok", 354 textConfirm ?? "Ok",
365 style: 355 style:
366 - TextStyle(color: confirmTextColor ?? theme.backgroundColor), 356 + TextStyle(color: confirmTextColor ?? theme!.backgroundColor),
367 ), 357 ),
368 onPressed: () { 358 onPressed: () {
369 onConfirm?.call(); 359 onConfirm?.call();
@@ -374,7 +364,7 @@ extension ExtensionDialog on GetInterface { @@ -374,7 +364,7 @@ extension ExtensionDialog on GetInterface {
374 Widget baseAlertDialog = AlertDialog( 364 Widget baseAlertDialog = AlertDialog(
375 titlePadding: EdgeInsets.all(8), 365 titlePadding: EdgeInsets.all(8),
376 contentPadding: EdgeInsets.all(8), 366 contentPadding: EdgeInsets.all(8),
377 - backgroundColor: backgroundColor ?? theme.dialogBackgroundColor, 367 + backgroundColor: backgroundColor ?? theme!.dialogBackgroundColor,
378 shape: RoundedRectangleBorder( 368 shape: RoundedRectangleBorder(
379 borderRadius: BorderRadius.all(Radius.circular(radius))), 369 borderRadius: BorderRadius.all(Radius.circular(radius))),
380 title: Text(title, textAlign: TextAlign.center, style: titleStyle), 370 title: Text(title, textAlign: TextAlign.center, style: titleStyle),
@@ -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(
@@ -420,39 +410,32 @@ extension ExtensionDialog on GetInterface { @@ -420,39 +410,32 @@ extension ExtensionDialog on GetInterface {
420 } 410 }
421 411
422 extension ExtensionBottomSheet on GetInterface { 412 extension ExtensionBottomSheet on GetInterface {
423 - Future<T> bottomSheet<T>( 413 + Future<T?> bottomSheet<T>(
424 Widget bottomsheet, { 414 Widget bottomsheet, {
425 - Color backgroundColor,  
426 - double elevation, 415 + Color? backgroundColor,
  416 + double? elevation,
427 bool persistent = true, 417 bool persistent = true,
428 - ShapeBorder shape,  
429 - Clip clipBehavior,  
430 - Color barrierColor,  
431 - bool ignoreSafeArea, 418 + ShapeBorder? shape,
  419 + Clip? clipBehavior,
  420 + Color? barrierColor,
  421 + bool? ignoreSafeArea,
432 bool isScrollControlled = false, 422 bool isScrollControlled = false,
433 bool useRootNavigator = false, 423 bool useRootNavigator = false,
434 bool isDismissible = true, 424 bool isDismissible = true,
435 bool enableDrag = true, 425 bool enableDrag = true,
436 - RouteSettings settings,  
437 - Duration enterBottomSheetDuration,  
438 - Duration exitBottomSheetDuration, 426 + RouteSettings? settings,
  427 + Duration? enterBottomSheetDuration,
  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,
450 isPersistent: persistent, 433 isPersistent: persistent,
451 // theme: Theme.of(key.currentContext, shadowThemeOnly: true), 434 // theme: Theme.of(key.currentContext, shadowThemeOnly: true),
452 - theme: Theme.of(key.currentContext), 435 + theme: Theme.of(key!.currentContext!),
453 isScrollControlled: isScrollControlled, 436 isScrollControlled: isScrollControlled,
454 - barrierLabel:  
455 - MaterialLocalizations.of(key.currentContext).modalBarrierDismissLabel, 437 + barrierLabel: MaterialLocalizations.of(key!.currentContext!)
  438 + .modalBarrierDismissLabel,
456 backgroundColor: backgroundColor ?? Colors.transparent, 439 backgroundColor: backgroundColor ?? Colors.transparent,
457 elevation: elevation, 440 elevation: elevation,
458 shape: shape, 441 shape: shape,
@@ -491,18 +474,18 @@ extension GetNavigation on GetInterface { @@ -491,18 +474,18 @@ extension GetNavigation on GetInterface {
491 /// 474 ///
492 /// By default, GetX will prevent you from push a route that you already in, 475 /// By default, GetX will prevent you from push a route that you already in,
493 /// if you want to push anyway, set [preventDuplicates] to false 476 /// if you want to push anyway, set [preventDuplicates] to false
494 - Future<T> to<T>( 477 + Future<T?>? to<T>(
495 dynamic page, { 478 dynamic page, {
496 - bool opaque,  
497 - Transition transition,  
498 - Curve curve,  
499 - Duration duration,  
500 - int id, 479 + bool? opaque,
  480 + Transition? transition,
  481 + Curve? curve,
  482 + Duration? duration,
  483 + int? id,
501 bool fullscreenDialog = false, 484 bool fullscreenDialog = false,
502 dynamic arguments, 485 dynamic arguments,
503 - Bindings binding, 486 + Bindings? binding,
504 bool preventDuplicates = true, 487 bool preventDuplicates = true,
505 - bool popGesture, 488 + bool? popGesture,
506 }) { 489 }) {
507 var routeName = "/${page.runtimeType.toString()}"; 490 var routeName = "/${page.runtimeType.toString()}";
508 if (preventDuplicates && routeName == currentRoute) { 491 if (preventDuplicates && routeName == currentRoute) {
@@ -558,12 +541,12 @@ you can only use widgets and widget functions here'''; @@ -558,12 +541,12 @@ you can only use widgets and widget functions here''';
558 /// if you want to push anyway, set [preventDuplicates] to false 541 /// if you want to push anyway, set [preventDuplicates] to false
559 /// 542 ///
560 /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors 543 /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors
561 - Future<T> toNamed<T>( 544 + Future<T?>? toNamed<T>(
562 String page, { 545 String page, {
563 dynamic arguments, 546 dynamic arguments,
564 - int id, 547 + int? id,
565 bool preventDuplicates = true, 548 bool preventDuplicates = true,
566 - Map<String, String> parameters, 549 + Map<String, String>? parameters,
567 }) { 550 }) {
568 if (preventDuplicates && page == currentRoute) { 551 if (preventDuplicates && page == currentRoute) {
569 return null; 552 return null;
@@ -596,12 +579,12 @@ you can only use widgets and widget functions here'''; @@ -596,12 +579,12 @@ you can only use widgets and widget functions here''';
596 /// if you want to push anyway, set [preventDuplicates] to false 579 /// if you want to push anyway, set [preventDuplicates] to false
597 /// 580 ///
598 /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors 581 /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors
599 - Future<T> offNamed<T>( 582 + Future<T?>? offNamed<T>(
600 String page, { 583 String page, {
601 dynamic arguments, 584 dynamic arguments,
602 - int id, 585 + int? id,
603 bool preventDuplicates = true, 586 bool preventDuplicates = true,
604 - Map<String, String> parameters, 587 + Map<String, String>? parameters,
605 }) { 588 }) {
606 if (preventDuplicates && page == currentRoute) { 589 if (preventDuplicates && page == currentRoute) {
607 return null; 590 return null;
@@ -630,7 +613,7 @@ you can only use widgets and widget functions here'''; @@ -630,7 +613,7 @@ you can only use widgets and widget functions here''';
630 /// or also like this: 613 /// or also like this:
631 /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the 614 /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the
632 /// dialog is closed 615 /// dialog is closed
633 - void until(RoutePredicate predicate, {int id}) { 616 + void until(RoutePredicate predicate, {int? id}) {
634 // if (key.currentState.mounted) // add this if appear problems on future with route navigate 617 // if (key.currentState.mounted) // add this if appear problems on future with route navigate
635 // when widget don't mounted 618 // when widget don't mounted
636 return global(id)?.currentState?.popUntil(predicate); 619 return global(id)?.currentState?.popUntil(predicate);
@@ -654,7 +637,7 @@ you can only use widgets and widget functions here'''; @@ -654,7 +637,7 @@ you can only use widgets and widget functions here''';
654 /// or also like this: 637 /// or also like this:
655 /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog 638 /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog
656 /// is closed 639 /// is closed
657 - Future<T> offUntil<T>(Route<T> page, RoutePredicate predicate, {int id}) { 640 + Future<T?>? offUntil<T>(Route<T> page, RoutePredicate predicate, {int? id}) {
658 // if (key.currentState.mounted) // add this if appear problems on future with route navigate 641 // if (key.currentState.mounted) // add this if appear problems on future with route navigate
659 // when widget don't mounted 642 // when widget don't mounted
660 return global(id)?.currentState?.pushAndRemoveUntil<T>(page, predicate); 643 return global(id)?.currentState?.pushAndRemoveUntil<T>(page, predicate);
@@ -678,12 +661,12 @@ you can only use widgets and widget functions here'''; @@ -678,12 +661,12 @@ you can only use widgets and widget functions here''';
678 /// to make sure the dialog is closed 661 /// to make sure the dialog is closed
679 /// 662 ///
680 /// Note: Always put a slash on the route name ('/page1'), to avoid unexpected errors 663 /// Note: Always put a slash on the route name ('/page1'), to avoid unexpected errors
681 - Future<T> offNamedUntil<T>( 664 + Future<T?>? offNamedUntil<T>(
682 String page, 665 String page,
683 RoutePredicate predicate, { 666 RoutePredicate predicate, {
684 - int id, 667 + int? id,
685 dynamic arguments, 668 dynamic arguments,
686 - Map<String, String> parameters, 669 + Map<String, String>? parameters,
687 }) { 670 }) {
688 if (parameters != null) { 671 if (parameters != null) {
689 final uri = Uri(path: page, queryParameters: parameters); 672 final uri = Uri(path: page, queryParameters: parameters);
@@ -708,12 +691,12 @@ you can only use widgets and widget functions here'''; @@ -708,12 +691,12 @@ you can only use widgets and widget functions here''';
708 /// The `offNamed()` pop a page, and goes to the next. The 691 /// The `offNamed()` pop a page, and goes to the next. The
709 /// `offAndToNamed()` goes to the next page, and removes the previous one. 692 /// `offAndToNamed()` goes to the next page, and removes the previous one.
710 /// The route transition animation is different. 693 /// The route transition animation is different.
711 - Future<T> offAndToNamed<T>( 694 + Future<T?>? offAndToNamed<T>(
712 String page, { 695 String page, {
713 dynamic arguments, 696 dynamic arguments,
714 - int id, 697 + int? id,
715 dynamic result, 698 dynamic result,
716 - Map<String, String> parameters, 699 + Map<String, String>? parameters,
717 }) { 700 }) {
718 if (parameters != null) { 701 if (parameters != null) {
719 final uri = Uri(path: page, queryParameters: parameters); 702 final uri = Uri(path: page, queryParameters: parameters);
@@ -732,7 +715,7 @@ you can only use widgets and widget functions here'''; @@ -732,7 +715,7 @@ you can only use widgets and widget functions here''';
732 /// 715 ///
733 /// [id] is for when you are using nested navigation, 716 /// [id] is for when you are using nested navigation,
734 /// as explained in documentation 717 /// as explained in documentation
735 - void removeRoute(Route<dynamic> route, {int id}) { 718 + void removeRoute(Route<dynamic> route, {int? id}) {
736 return global(id)?.currentState?.removeRoute(route); 719 return global(id)?.currentState?.removeRoute(route);
737 } 720 }
738 721
@@ -756,12 +739,12 @@ you can only use widgets and widget functions here'''; @@ -756,12 +739,12 @@ you can only use widgets and widget functions here''';
756 /// as explained in documentation 739 /// as explained in documentation
757 /// 740 ///
758 /// Note: Always put a slash on the route ('/page1'), to avoid unexpected errors 741 /// Note: Always put a slash on the route ('/page1'), to avoid unexpected errors
759 - Future<T> offAllNamed<T>( 742 + Future<T?>? offAllNamed<T>(
760 String newRouteName, { 743 String newRouteName, {
761 - RoutePredicate predicate, 744 + RoutePredicate? predicate,
762 dynamic arguments, 745 dynamic arguments,
763 - int id,  
764 - Map<String, String> parameters, 746 + int? id,
  747 + Map<String, String>? parameters,
765 }) { 748 }) {
766 if (parameters != null) { 749 if (parameters != null) {
767 final uri = Uri(path: newRouteName, queryParameters: parameters); 750 final uri = Uri(path: newRouteName, queryParameters: parameters);
@@ -777,11 +760,11 @@ you can only use widgets and widget functions here'''; @@ -777,11 +760,11 @@ you can only use widgets and widget functions here''';
777 760
778 /// Returns true if a Snackbar, Dialog or BottomSheet is currently OPEN 761 /// Returns true if a Snackbar, Dialog or BottomSheet is currently OPEN
779 bool get isOverlaysOpen => 762 bool get isOverlaysOpen =>
780 - (isSnackbarOpen || isDialogOpen || isBottomSheetOpen); 763 + (isSnackbarOpen! || isDialogOpen! || isBottomSheetOpen!);
781 764
782 /// Returns true if there is no Snackbar, Dialog or BottomSheet open 765 /// Returns true if there is no Snackbar, Dialog or BottomSheet open
783 bool get isOverlaysClosed => 766 bool get isOverlaysClosed =>
784 - (!isSnackbarOpen && !isDialogOpen && !isBottomSheetOpen); 767 + (!isSnackbarOpen! && !isDialogOpen! && !isBottomSheetOpen!);
785 768
786 /// **Navigation.popUntil()** shortcut.<br><br> 769 /// **Navigation.popUntil()** shortcut.<br><br>
787 /// 770 ///
@@ -796,10 +779,10 @@ you can only use widgets and widget functions here'''; @@ -796,10 +779,10 @@ you can only use widgets and widget functions here''';
796 /// It has the advantage of not needing context, so you can call 779 /// It has the advantage of not needing context, so you can call
797 /// from your business logic. 780 /// from your business logic.
798 void back<T>({ 781 void back<T>({
799 - T result, 782 + T? result,
800 bool closeOverlays = false, 783 bool closeOverlays = false,
801 bool canPop = true, 784 bool canPop = true,
802 - int id, 785 + int? id,
803 }) { 786 }) {
804 if (closeOverlays && isOverlaysOpen) { 787 if (closeOverlays && isOverlaysOpen) {
805 navigator?.popUntil((route) { 788 navigator?.popUntil((route) {
@@ -821,8 +804,8 @@ you can only use widgets and widget functions here'''; @@ -821,8 +804,8 @@ you can only use widgets and widget functions here''';
821 /// 804 ///
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]) {  
825 - if ((times == null) || (times < 1)) { 807 + void close(int times, [int? id]) {
  808 + if (times < 1) {
826 times = 1; 809 times = 1;
827 } 810 }
828 var count = 0; 811 var count = 0;
@@ -856,25 +839,25 @@ you can only use widgets and widget functions here'''; @@ -856,25 +839,25 @@ you can only use widgets and widget functions here''';
856 /// 839 ///
857 /// By default, GetX will prevent you from push a route that you already in, 840 /// By default, GetX will prevent you from push a route that you already in,
858 /// if you want to push anyway, set [preventDuplicates] to false 841 /// if you want to push anyway, set [preventDuplicates] to false
859 - Future<T> off<T>( 842 + Future<T?>? off<T>(
860 dynamic page, { 843 dynamic page, {
861 bool opaque = false, 844 bool opaque = false,
862 - Transition transition,  
863 - Curve curve,  
864 - bool popGesture,  
865 - int id, 845 + Transition? transition,
  846 + Curve? curve,
  847 + bool? popGesture,
  848 + int? id,
866 dynamic arguments, 849 dynamic arguments,
867 - Bindings binding, 850 + Bindings? binding,
868 bool fullscreenDialog = false, 851 bool fullscreenDialog = false,
869 bool preventDuplicates = true, 852 bool preventDuplicates = true,
870 - Duration duration, 853 + Duration? duration,
871 }) { 854 }) {
872 var routeName = "/${page.runtimeType.toString()}"; 855 var routeName = "/${page.runtimeType.toString()}";
873 if (preventDuplicates && routeName == currentRoute) { 856 if (preventDuplicates && routeName == currentRoute) {
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),
@@ -917,24 +900,24 @@ you can only use widgets and widget functions here'''; @@ -917,24 +900,24 @@ you can only use widgets and widget functions here''';
917 /// 900 ///
918 /// By default, GetX will prevent you from push a route that you already in, 901 /// By default, GetX will prevent you from push a route that you already in,
919 /// if you want to push anyway, set [preventDuplicates] to false 902 /// if you want to push anyway, set [preventDuplicates] to false
920 - Future<T> offAll<T>( 903 + Future<T?>? offAll<T>(
921 dynamic page, { 904 dynamic page, {
922 - RoutePredicate predicate, 905 + RoutePredicate? predicate,
923 bool opaque = false, 906 bool opaque = false,
924 - bool popGesture,  
925 - int id, 907 + bool? popGesture,
  908 + int? id,
926 dynamic arguments, 909 dynamic arguments,
927 - Bindings binding, 910 + Bindings? binding,
928 bool fullscreenDialog = false, 911 bool fullscreenDialog = false,
929 - Transition transition,  
930 - Curve curve,  
931 - Duration duration, 912 + Transition? transition,
  913 + Curve? curve,
  914 + Duration? duration,
932 }) { 915 }) {
933 var routeName = "/${page.runtimeType.toString()}"; 916 var routeName = "/${page.runtimeType.toString()}";
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,
@@ -948,32 +931,28 @@ you can only use widgets and widget functions here'''; @@ -948,32 +931,28 @@ you can only use widgets and widget functions here''';
948 predicate ?? (route) => false); 931 predicate ?? (route) => false);
949 } 932 }
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(); 936 routeTree = ParseRouteTree();
955 - }  
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(); 943 + routeTree = ParseRouteTree();
964 routeTree.addRoute(getPage); 944 routeTree.addRoute(getPage);
965 } 945 }
966 - }  
967 946
968 /// change default config of Get 947 /// change default config of Get
969 void config( 948 void config(
970 - {bool enableLog,  
971 - LogWriterCallback logWriterCallback,  
972 - bool defaultPopGesture,  
973 - bool defaultOpaqueRoute,  
974 - Duration defaultDurationTransition,  
975 - bool defaultGlobalState,  
976 - Transition defaultTransition}) { 949 + {bool? enableLog,
  950 + LogWriterCallback? logWriterCallback,
  951 + bool? defaultPopGesture,
  952 + bool? defaultOpaqueRoute,
  953 + Duration? defaultDurationTransition,
  954 + bool? defaultGlobalState,
  955 + Transition? defaultTransition}) {
977 if (enableLog != null) { 956 if (enableLog != null) {
978 Get.isLogEnable = enableLog; 957 Get.isLogEnable = enableLog;
979 } 958 }
@@ -1014,7 +993,7 @@ you can only use widgets and widget functions here'''; @@ -1014,7 +993,7 @@ you can only use widgets and widget functions here''';
1014 /// Your entire application will be rebuilt, and touch events will not 993 /// Your entire application will be rebuilt, and touch events will not
1015 /// work until the end of rendering. 994 /// work until the end of rendering.
1016 void forceAppUpdate() { 995 void forceAppUpdate() {
1017 - engine.performReassemble(); 996 + engine!.performReassemble();
1018 } 997 }
1019 998
1020 void appUpdate() => getxController.update(); 999 void appUpdate() => getxController.update();
@@ -1027,18 +1006,18 @@ you can only use widgets and widget functions here'''; @@ -1027,18 +1006,18 @@ you can only use widgets and widget functions here''';
1027 getxController.setThemeMode(themeMode); 1006 getxController.setThemeMode(themeMode);
1028 } 1007 }
1029 1008
1030 - GlobalKey<NavigatorState> addKey(GlobalKey<NavigatorState> newKey) { 1009 + GlobalKey<NavigatorState>? addKey(GlobalKey<NavigatorState>? newKey) {
1031 getxController.key = newKey; 1010 getxController.key = newKey;
1032 return key; 1011 return key;
1033 } 1012 }
1034 1013
1035 - GlobalKey<NavigatorState> nestedKey(int key) { 1014 + GlobalKey<NavigatorState>? nestedKey(int key) {
1036 keys.putIfAbsent(key, () => GlobalKey<NavigatorState>()); 1015 keys.putIfAbsent(key, () => GlobalKey<NavigatorState>());
1037 return keys[key]; 1016 return keys[key];
1038 } 1017 }
1039 1018
1040 - GlobalKey<NavigatorState> global(int k) {  
1041 - GlobalKey<NavigatorState> _key; 1019 + GlobalKey<NavigatorState>? global(int? k) {
  1020 + GlobalKey<NavigatorState>? _key;
1042 if (k == null) { 1021 if (k == null) {
1043 _key = key; 1022 _key = key;
1044 } else { 1023 } else {
@@ -1048,7 +1027,7 @@ you can only use widgets and widget functions here'''; @@ -1048,7 +1027,7 @@ you can only use widgets and widget functions here''';
1048 _key = keys[k]; 1027 _key = keys[k];
1049 } 1028 }
1050 1029
1051 - if (_key.currentContext == null && !testMode) { 1030 + if (_key!.currentContext == null && !testMode) {
1052 throw """You are trying to use contextless navigation without 1031 throw """You are trying to use contextless navigation without
1053 a GetMaterialApp or Get.key. 1032 a GetMaterialApp or Get.key.
1054 If you are testing your app, you can use: 1033 If you are testing your app, you can use:
@@ -1065,7 +1044,7 @@ you can only use widgets and widget functions here'''; @@ -1065,7 +1044,7 @@ you can only use widgets and widget functions here''';
1065 Since version 2.8 it is possible to access the properties 1044 Since version 2.8 it is possible to access the properties
1066 [Get.arguments] and [Get.currentRoute] directly. 1045 [Get.arguments] and [Get.currentRoute] directly.
1067 [routeSettings] is useless and should not be used.''') 1046 [routeSettings] is useless and should not be used.''')
1068 - RouteSettings get routeSettings => null; 1047 + RouteSettings? get routeSettings => null;
1069 1048
1070 /// give current arguments 1049 /// give current arguments
1071 dynamic get arguments => routing.args; 1050 dynamic get arguments => routing.args;
@@ -1077,16 +1056,16 @@ Since version 2.8 it is possible to access the properties @@ -1077,16 +1056,16 @@ Since version 2.8 it is possible to access the properties
1077 String get previousRoute => routing.previous; 1056 String get previousRoute => routing.previous;
1078 1057
1079 /// check if snackbar is open 1058 /// check if snackbar is open
1080 - bool get isSnackbarOpen => routing.isSnackbar; 1059 + bool? get isSnackbarOpen => routing.isSnackbar;
1081 1060
1082 /// check if dialog is open 1061 /// check if dialog is open
1083 - bool get isDialogOpen => routing.isDialog; 1062 + bool? get isDialogOpen => routing.isDialog;
1084 1063
1085 /// check if bottomsheet is open 1064 /// check if bottomsheet is open
1086 - bool get isBottomSheetOpen => routing.isBottomSheet; 1065 + bool? get isBottomSheetOpen => routing.isBottomSheet;
1087 1066
1088 /// check a raw current route 1067 /// check a raw current route
1089 - Route<dynamic> get rawRoute => routing.route; 1068 + Route<dynamic>? get rawRoute => routing.route;
1090 1069
1091 /// check if popGesture is enable 1070 /// check if popGesture is enable
1092 bool get isPopGestureEnable => defaultPopGesture; 1071 bool get isPopGestureEnable => defaultPopGesture;
@@ -1095,28 +1074,28 @@ Since version 2.8 it is possible to access the properties @@ -1095,28 +1074,28 @@ Since version 2.8 it is possible to access the properties
1095 bool get isOpaqueRouteDefault => defaultOpaqueRoute; 1074 bool get isOpaqueRouteDefault => defaultOpaqueRoute;
1096 1075
1097 /// give access to currentContext 1076 /// give access to currentContext
1098 - BuildContext get context => key?.currentContext; 1077 + BuildContext? get context => key?.currentContext;
1099 1078
1100 /// give access to current Overlay Context 1079 /// give access to current Overlay Context
1101 - BuildContext get overlayContext {  
1102 - BuildContext overlay;  
1103 - key?.currentState?.overlay?.context?.visitChildElements((element) { 1080 + BuildContext? get overlayContext {
  1081 + BuildContext? overlay;
  1082 + key?.currentState?.overlay?.context.visitChildElements((element) {
1104 overlay = element; 1083 overlay = element;
1105 }); 1084 });
1106 return overlay; 1085 return overlay;
1107 } 1086 }
1108 1087
1109 /// give access to Theme.of(context) 1088 /// give access to Theme.of(context)
1110 - ThemeData get theme {  
1111 - ThemeData _theme; 1089 + ThemeData? get theme {
  1090 + ThemeData? _theme;
1112 if (context != null) { 1091 if (context != null) {
1113 - _theme = Theme.of(context); 1092 + _theme = Theme.of(context!);
1114 } 1093 }
1115 return _theme; 1094 return _theme;
1116 } 1095 }
1117 1096
1118 ///The current [WidgetsBinding] 1097 ///The current [WidgetsBinding]
1119 - WidgetsBinding get engine { 1098 + WidgetsBinding? get engine {
1120 if (WidgetsBinding.instance == null) { 1099 if (WidgetsBinding.instance == null) {
1121 WidgetsFlutterBinding(); 1100 WidgetsFlutterBinding();
1122 } 1101 }
@@ -1126,9 +1105,9 @@ Since version 2.8 it is possible to access the properties @@ -1126,9 +1105,9 @@ Since version 2.8 it is possible to access the properties
1126 //TODO: Change to ui.SingletonFlutterWindow rather dynamic 1105 //TODO: Change to ui.SingletonFlutterWindow rather dynamic
1127 //when Flutter update stable. dynamic is used to avoid Breaking Changes 1106 //when Flutter update stable. dynamic is used to avoid Breaking Changes
1128 /// The window to which this binding is bound. 1107 /// The window to which this binding is bound.
1129 - dynamic get window => ui.window; 1108 + ui.SingletonFlutterWindow get window => ui.window;
1130 1109
1131 - Locale get deviceLocale => ui.window.locale; 1110 + Locale? get deviceLocale => ui.window.locale;
1132 1111
1133 ///The number of device pixels for each logical pixel. 1112 ///The number of device pixels for each logical pixel.
1134 double get pixelRatio => ui.window.devicePixelRatio; 1113 double get pixelRatio => ui.window.devicePixelRatio;
@@ -1153,23 +1132,23 @@ Since version 2.8 it is possible to access the properties @@ -1153,23 +1132,23 @@ Since version 2.8 it is possible to access the properties
1153 double get textScaleFactor => ui.window.textScaleFactor; 1132 double get textScaleFactor => ui.window.textScaleFactor;
1154 1133
1155 /// give access to TextTheme.of(context) 1134 /// give access to TextTheme.of(context)
1156 - TextTheme get textTheme => theme?.textTheme; 1135 + TextTheme? get textTheme => theme?.textTheme;
1157 1136
1158 /// give access to Mediaquery.of(context) 1137 /// give access to Mediaquery.of(context)
1159 - MediaQueryData get mediaQuery => MediaQuery.of(context); 1138 + MediaQueryData get mediaQuery => MediaQuery.of(context!);
1160 1139
1161 /// Check if dark mode theme is enable 1140 /// Check if dark mode theme is enable
1162 - bool get isDarkMode => (theme.brightness == Brightness.dark); 1141 + bool get isDarkMode => (theme!.brightness == Brightness.dark);
1163 1142
1164 /// Check if dark mode theme is enable on platform on android Q+ 1143 /// Check if dark mode theme is enable on platform on android Q+
1165 bool get isPlatformDarkMode => 1144 bool get isPlatformDarkMode =>
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;
1173 1152
1174 // /// give access to Immutable MediaQuery.of(context).size.height 1153 // /// give access to Immutable MediaQuery.of(context).size.height
1175 // double get height => MediaQuery.of(context).size.height; 1154 // double get height => MediaQuery.of(context).size.height;
@@ -1177,16 +1156,16 @@ Since version 2.8 it is possible to access the properties @@ -1177,16 +1156,16 @@ Since version 2.8 it is possible to access the properties
1177 // /// give access to Immutable MediaQuery.of(context).size.width 1156 // /// give access to Immutable MediaQuery.of(context).size.width
1178 // double get width => MediaQuery.of(context).size.width; 1157 // double get width => MediaQuery.of(context).size.width;
1179 1158
1180 - GlobalKey<NavigatorState> get key => getxController?.key; 1159 + GlobalKey<NavigatorState>? get key => getxController.key;
1181 1160
1182 - Map<int, GlobalKey<NavigatorState>> get keys => getxController?.keys; 1161 + Map<int, GlobalKey<NavigatorState>> get keys => getxController.keys;
1183 1162
1184 GetMaterialController get rootController => getxController; 1163 GetMaterialController get rootController => getxController;
1185 1164
1186 bool get defaultPopGesture => getxController.defaultPopGesture; 1165 bool get defaultPopGesture => getxController.defaultPopGesture;
1187 bool get defaultOpaqueRoute => getxController.defaultOpaqueRoute; 1166 bool get defaultOpaqueRoute => getxController.defaultOpaqueRoute;
1188 1167
1189 - Transition get defaultTransition => getxController.defaultTransition; 1168 + Transition? get defaultTransition => getxController.defaultTransition;
1190 1169
1191 Duration get defaultTransitionDuration { 1170 Duration get defaultTransitionDuration {
1192 return getxController.defaultTransitionDuration; 1171 return getxController.defaultTransitionDuration;
@@ -1204,15 +1183,15 @@ Since version 2.8 it is possible to access the properties @@ -1204,15 +1183,15 @@ 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;
1212 set routeTree(ParseRouteTree tree) => getxController.routeTree = tree; 1191 set routeTree(ParseRouteTree tree) => getxController.routeTree = tree;
1213 1192
1214 - CustomTransition get customTransition => getxController.customTransition;  
1215 - set customTransition(CustomTransition newTransition) => 1193 + CustomTransition? get customTransition => getxController.customTransition;
  1194 + set customTransition(CustomTransition? newTransition) =>
1216 getxController.customTransition = newTransition; 1195 getxController.customTransition = newTransition;
1217 1196
1218 bool get testMode => getxController.testMode; 1197 bool get testMode => getxController.testMode;
@@ -1224,4 +1203,4 @@ Since version 2.8 it is possible to access the properties @@ -1224,4 +1203,4 @@ Since version 2.8 it is possible to access the properties
1224 /// It replaces the Flutter Navigator, but needs no context. 1203 /// It replaces the Flutter Navigator, but needs no context.
1225 /// You can to use navigator.push(YourRoute()) rather 1204 /// You can to use navigator.push(YourRoute()) rather
1226 /// Navigator.push(context, YourRoute()); 1205 /// Navigator.push(context, YourRoute());
1227 -NavigatorState get navigator => GetNavigation(Get).key.currentState; 1206 +NavigatorState? get navigator => GetNavigation(Get).key!.currentState;
@@ -10,16 +10,18 @@ import 'root_controller.dart'; @@ -10,16 +10,18 @@ import 'root_controller.dart';
10 10
11 class GetCupertinoApp extends StatelessWidget { 11 class GetCupertinoApp extends StatelessWidget {
12 const GetCupertinoApp({ 12 const GetCupertinoApp({
13 - Key key, 13 + Key? key,
14 this.theme, 14 this.theme,
15 this.navigatorKey, 15 this.navigatorKey,
16 this.home, 16 this.home,
17 - this.routes = const <String, WidgetBuilder>{}, 17 + Map<String, Widget Function(BuildContext)> this.routes =
  18 + const <String, WidgetBuilder>{},
18 this.initialRoute, 19 this.initialRoute,
19 this.onGenerateRoute, 20 this.onGenerateRoute,
20 this.onGenerateInitialRoutes, 21 this.onGenerateInitialRoutes,
21 this.onUnknownRoute, 22 this.onUnknownRoute,
22 - this.navigatorObservers = const <NavigatorObserver>[], 23 + List<NavigatorObserver> this.navigatorObservers =
  24 + const <NavigatorObserver>[],
23 this.builder, 25 this.builder,
24 this.translationsKeys, 26 this.translationsKeys,
25 this.translations, 27 this.translations,
@@ -58,78 +60,70 @@ class GetCupertinoApp extends StatelessWidget { @@ -58,78 +60,70 @@ class GetCupertinoApp extends StatelessWidget {
58 this.highContrastTheme, 60 this.highContrastTheme,
59 this.highContrastDarkTheme, 61 this.highContrastDarkTheme,
60 this.actions, 62 this.actions,
61 - }) : assert(routes != null),  
62 - assert(navigatorObservers != null),  
63 - assert(title != null),  
64 - assert(showPerformanceOverlay != null),  
65 - assert(checkerboardRasterCacheImages != null),  
66 - assert(checkerboardOffscreenLayers != null),  
67 - assert(showSemanticsDebugger != null),  
68 - assert(debugShowCheckedModeBanner != null),  
69 - routeInformationProvider = null, 63 + }) : routeInformationProvider = null,
70 routeInformationParser = null, 64 routeInformationParser = null,
71 routerDelegate = null, 65 routerDelegate = null,
72 backButtonDispatcher = null, 66 backButtonDispatcher = null,
73 super(key: key); 67 super(key: key);
74 68
75 - final GlobalKey<NavigatorState> navigatorKey;  
76 - final Widget home;  
77 - final Map<String, WidgetBuilder> routes;  
78 - final String initialRoute;  
79 - final RouteFactory onGenerateRoute;  
80 - final InitialRouteListFactory onGenerateInitialRoutes;  
81 - final RouteFactory onUnknownRoute;  
82 - final List<NavigatorObserver> navigatorObservers;  
83 - final TransitionBuilder builder; 69 + final GlobalKey<NavigatorState>? navigatorKey;
  70 + final Widget? home;
  71 + final Map<String, WidgetBuilder>? routes;
  72 + final String? initialRoute;
  73 + final RouteFactory? onGenerateRoute;
  74 + final InitialRouteListFactory? onGenerateInitialRoutes;
  75 + final RouteFactory? onUnknownRoute;
  76 + final List<NavigatorObserver>? navigatorObservers;
  77 + final TransitionBuilder? builder;
84 final String title; 78 final String title;
85 - final GenerateAppTitle onGenerateTitle;  
86 - final CustomTransition customTransition;  
87 - final Color color;  
88 - final Map<String, Map<String, String>> translationsKeys;  
89 - final Translations translations;  
90 - final TextDirection textDirection;  
91 - final Locale locale;  
92 - final Locale fallbackLocale;  
93 - final Iterable<LocalizationsDelegate<dynamic>> localizationsDelegates;  
94 - final LocaleListResolutionCallback localeListResolutionCallback;  
95 - final LocaleResolutionCallback localeResolutionCallback; 79 + final GenerateAppTitle? onGenerateTitle;
  80 + final CustomTransition? customTransition;
  81 + final Color? color;
  82 + final Map<String, Map<String, String>>? translationsKeys;
  83 + final Translations? translations;
  84 + final TextDirection? textDirection;
  85 + final Locale? locale;
  86 + final Locale? fallbackLocale;
  87 + final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates;
  88 + final LocaleListResolutionCallback? localeListResolutionCallback;
  89 + final LocaleResolutionCallback? localeResolutionCallback;
96 final Iterable<Locale> supportedLocales; 90 final Iterable<Locale> supportedLocales;
97 final bool showPerformanceOverlay; 91 final bool showPerformanceOverlay;
98 final bool checkerboardRasterCacheImages; 92 final bool checkerboardRasterCacheImages;
99 final bool checkerboardOffscreenLayers; 93 final bool checkerboardOffscreenLayers;
100 final bool showSemanticsDebugger; 94 final bool showSemanticsDebugger;
101 final bool debugShowCheckedModeBanner; 95 final bool debugShowCheckedModeBanner;
102 - final Map<LogicalKeySet, Intent> shortcuts;  
103 - final ThemeData highContrastTheme;  
104 - final ThemeData highContrastDarkTheme;  
105 - final Map<Type, Action<Intent>> actions;  
106 - final Function(Routing) routingCallback;  
107 - final Transition defaultTransition;  
108 - final bool opaqueRoute;  
109 - final VoidCallback onInit;  
110 - final VoidCallback onReady;  
111 - final VoidCallback onDispose;  
112 - final bool enableLog;  
113 - final LogWriterCallback logWriterCallback;  
114 - final bool popGesture; 96 + final Map<LogicalKeySet, Intent>? shortcuts;
  97 + final ThemeData? highContrastTheme;
  98 + final ThemeData? highContrastDarkTheme;
  99 + final Map<Type, Action<Intent>>? actions;
  100 + final Function(Routing?)? routingCallback;
  101 + final Transition? defaultTransition;
  102 + final bool? opaqueRoute;
  103 + final VoidCallback? onInit;
  104 + final VoidCallback? onReady;
  105 + final VoidCallback? onDispose;
  106 + final bool? enableLog;
  107 + final LogWriterCallback? logWriterCallback;
  108 + final bool? popGesture;
115 final SmartManagement smartManagement; 109 final SmartManagement smartManagement;
116 - final Bindings initialBinding;  
117 - final Duration transitionDuration;  
118 - final bool defaultGlobalState;  
119 - final List<GetPage> getPages;  
120 - final GetPage unknownRoute;  
121 - final RouteInformationProvider routeInformationProvider;  
122 - final RouteInformationParser<Object> routeInformationParser;  
123 - final RouterDelegate<Object> routerDelegate;  
124 - final BackButtonDispatcher backButtonDispatcher;  
125 - final CupertinoThemeData theme; 110 + final Bindings? initialBinding;
  111 + final Duration? transitionDuration;
  112 + final bool? defaultGlobalState;
  113 + final List<GetPage>? getPages;
  114 + final GetPage? unknownRoute;
  115 + final RouteInformationProvider? routeInformationProvider;
  116 + final RouteInformationParser<Object>? routeInformationParser;
  117 + final RouterDelegate<Object>? routerDelegate;
  118 + final BackButtonDispatcher? backButtonDispatcher;
  119 + final CupertinoThemeData? theme;
126 120
127 const GetCupertinoApp.router({ 121 const GetCupertinoApp.router({
128 - Key key, 122 + Key? key,
129 this.theme, 123 this.theme,
130 this.routeInformationProvider, 124 this.routeInformationProvider,
131 - @required this.routeInformationParser,  
132 - @required this.routerDelegate, 125 + required RouteInformationParser<Object> this.routeInformationParser,
  126 + required RouterDelegate<Object> this.routerDelegate,
133 this.backButtonDispatcher, 127 this.backButtonDispatcher,
134 this.builder, 128 this.builder,
135 this.title = '', 129 this.title = '',
@@ -169,15 +163,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -169,15 +163,7 @@ class GetCupertinoApp extends StatelessWidget {
169 this.defaultGlobalState, 163 this.defaultGlobalState,
170 this.getPages, 164 this.getPages,
171 this.unknownRoute, 165 this.unknownRoute,
172 - }) : assert(routeInformationParser != null),  
173 - assert(routerDelegate != null),  
174 - assert(title != null),  
175 - assert(showPerformanceOverlay != null),  
176 - assert(checkerboardRasterCacheImages != null),  
177 - assert(checkerboardOffscreenLayers != null),  
178 - assert(showSemanticsDebugger != null),  
179 - assert(debugShowCheckedModeBanner != null),  
180 - navigatorObservers = null, 166 + }) : navigatorObservers = null,
181 navigatorKey = null, 167 navigatorKey = null,
182 onGenerateRoute = null, 168 onGenerateRoute = null,
183 home = null, 169 home = null,
@@ -201,7 +187,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -201,7 +187,7 @@ class GetCupertinoApp extends StatelessWidget {
201 onDispose?.call(); 187 onDispose?.call();
202 }, 188 },
203 initState: (i) { 189 initState: (i) {
204 - Get.engine.addPostFrameCallback((timeStamp) { 190 + Get.engine!.addPostFrameCallback((timeStamp) {
205 onReady?.call(); 191 onReady?.call();
206 }); 192 });
207 if (locale != null) Get.locale = locale; 193 if (locale != null) Get.locale = locale;
@@ -209,9 +195,9 @@ class GetCupertinoApp extends StatelessWidget { @@ -209,9 +195,9 @@ class GetCupertinoApp extends StatelessWidget {
209 if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale; 195 if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale;
210 196
211 if (translations != null) { 197 if (translations != null) {
212 - Get.addTranslations(translations.keys); 198 + Get.addTranslations(translations!.keys);
213 } else if (translationsKeys != null) { 199 } else if (translationsKeys != null) {
214 - Get.addTranslations(translationsKeys); 200 + Get.addTranslations(translationsKeys!);
215 } 201 }
216 202
217 Get.customTransition = customTransition; 203 Get.customTransition = customTransition;
@@ -233,8 +219,8 @@ class GetCupertinoApp extends StatelessWidget { @@ -233,8 +219,8 @@ class GetCupertinoApp extends StatelessWidget {
233 }, 219 },
234 builder: (_) => routerDelegate != null 220 builder: (_) => routerDelegate != null
235 ? CupertinoApp.router( 221 ? CupertinoApp.router(
236 - routerDelegate: routerDelegate,  
237 - routeInformationParser: routeInformationParser, 222 + routerDelegate: routerDelegate!,
  223 + routeInformationParser: routeInformationParser!,
238 backButtonDispatcher: backButtonDispatcher, 224 backButtonDispatcher: backButtonDispatcher,
239 routeInformationProvider: routeInformationProvider, 225 routeInformationProvider: routeInformationProvider,
240 key: _.unikey, 226 key: _.unikey,
@@ -245,24 +231,22 @@ class GetCupertinoApp extends StatelessWidget { @@ -245,24 +231,22 @@ class GetCupertinoApp extends StatelessWidget {
245 (rtlLanguages.contains(Get.locale?.languageCode) 231 (rtlLanguages.contains(Get.locale?.languageCode)
246 ? TextDirection.rtl 232 ? TextDirection.rtl
247 : TextDirection.ltr), 233 : TextDirection.ltr),
248 - child: builder == null ? child : builder(context, child), 234 + child: builder == null ? child! : builder!(context, child),
249 ); 235 );
250 }, 236 },
251 - title: title ?? '', 237 + title: title,
252 onGenerateTitle: onGenerateTitle, 238 onGenerateTitle: onGenerateTitle,
253 color: color, 239 color: color,
254 locale: Get.locale ?? locale, 240 locale: Get.locale ?? locale,
255 localizationsDelegates: localizationsDelegates, 241 localizationsDelegates: localizationsDelegates,
256 localeListResolutionCallback: localeListResolutionCallback, 242 localeListResolutionCallback: localeListResolutionCallback,
257 localeResolutionCallback: localeResolutionCallback, 243 localeResolutionCallback: localeResolutionCallback,
258 - supportedLocales:  
259 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
260 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
261 - checkerboardRasterCacheImages:  
262 - checkerboardRasterCacheImages ?? false,  
263 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
264 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
265 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, 244 + supportedLocales: supportedLocales,
  245 + showPerformanceOverlay: showPerformanceOverlay,
  246 + checkerboardRasterCacheImages: checkerboardRasterCacheImages,
  247 + checkerboardOffscreenLayers: checkerboardOffscreenLayers,
  248 + showSemanticsDebugger: showSemanticsDebugger,
  249 + debugShowCheckedModeBanner: debugShowCheckedModeBanner,
266 shortcuts: shortcuts, 250 shortcuts: shortcuts,
267 ) 251 )
268 : CupertinoApp( 252 : CupertinoApp(
@@ -285,31 +269,29 @@ class GetCupertinoApp extends StatelessWidget { @@ -285,31 +269,29 @@ class GetCupertinoApp extends StatelessWidget {
285 : <NavigatorObserver>[ 269 : <NavigatorObserver>[
286 GetObserver(routingCallback, Get.routing) 270 GetObserver(routingCallback, Get.routing)
287 ] 271 ]
288 - ..addAll(navigatorObservers)), 272 + ..addAll(navigatorObservers!)),
289 builder: (context, child) { 273 builder: (context, child) {
290 return Directionality( 274 return Directionality(
291 textDirection: textDirection ?? 275 textDirection: textDirection ??
292 (rtlLanguages.contains(Get.locale?.languageCode) 276 (rtlLanguages.contains(Get.locale?.languageCode)
293 ? TextDirection.rtl 277 ? TextDirection.rtl
294 : TextDirection.ltr), 278 : TextDirection.ltr),
295 - child: builder == null ? child : builder(context, child), 279 + child: builder == null ? child! : builder!(context, child),
296 ); 280 );
297 }, 281 },
298 - title: title ?? '', 282 + title: title,
299 onGenerateTitle: onGenerateTitle, 283 onGenerateTitle: onGenerateTitle,
300 color: color, 284 color: color,
301 locale: Get.locale ?? locale, 285 locale: Get.locale ?? locale,
302 localizationsDelegates: localizationsDelegates, 286 localizationsDelegates: localizationsDelegates,
303 localeListResolutionCallback: localeListResolutionCallback, 287 localeListResolutionCallback: localeListResolutionCallback,
304 localeResolutionCallback: localeResolutionCallback, 288 localeResolutionCallback: localeResolutionCallback,
305 - supportedLocales:  
306 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
307 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
308 - checkerboardRasterCacheImages:  
309 - checkerboardRasterCacheImages ?? false,  
310 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
311 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
312 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, 289 + supportedLocales: supportedLocales,
  290 + showPerformanceOverlay: showPerformanceOverlay,
  291 + checkerboardRasterCacheImages: checkerboardRasterCacheImages,
  292 + checkerboardOffscreenLayers: checkerboardOffscreenLayers,
  293 + showSemanticsDebugger: showSemanticsDebugger,
  294 + debugShowCheckedModeBanner: debugShowCheckedModeBanner,
313 shortcuts: shortcuts, 295 shortcuts: shortcuts,
314 // actions: actions, 296 // actions: actions,
315 )); 297 ));
@@ -10,15 +10,17 @@ import 'root_controller.dart'; @@ -10,15 +10,17 @@ import 'root_controller.dart';
10 10
11 class GetMaterialApp extends StatelessWidget { 11 class GetMaterialApp extends StatelessWidget {
12 const GetMaterialApp({ 12 const GetMaterialApp({
13 - Key key, 13 + Key? key,
14 this.navigatorKey, 14 this.navigatorKey,
15 this.home, 15 this.home,
16 - this.routes = const <String, WidgetBuilder>{}, 16 + Map<String, Widget Function(BuildContext)> this.routes =
  17 + const <String, WidgetBuilder>{},
17 this.initialRoute, 18 this.initialRoute,
18 this.onGenerateRoute, 19 this.onGenerateRoute,
19 this.onGenerateInitialRoutes, 20 this.onGenerateInitialRoutes,
20 this.onUnknownRoute, 21 this.onUnknownRoute,
21 - this.navigatorObservers = const <NavigatorObserver>[], 22 + List<NavigatorObserver> this.navigatorObservers =
  23 + const <NavigatorObserver>[],
22 this.builder, 24 this.builder,
23 this.textDirection, 25 this.textDirection,
24 this.title = '', 26 this.title = '',
@@ -61,81 +63,72 @@ class GetMaterialApp extends StatelessWidget { @@ -61,81 +63,72 @@ class GetMaterialApp extends StatelessWidget {
61 this.highContrastTheme, 63 this.highContrastTheme,
62 this.highContrastDarkTheme, 64 this.highContrastDarkTheme,
63 this.actions, 65 this.actions,
64 - }) : assert(routes != null),  
65 - assert(navigatorObservers != null),  
66 - assert(title != null),  
67 - assert(debugShowMaterialGrid != null),  
68 - assert(showPerformanceOverlay != null),  
69 - assert(checkerboardRasterCacheImages != null),  
70 - assert(checkerboardOffscreenLayers != null),  
71 - assert(showSemanticsDebugger != null),  
72 - assert(debugShowCheckedModeBanner != null),  
73 - routeInformationProvider = null, 66 + }) : routeInformationProvider = null,
74 routeInformationParser = null, 67 routeInformationParser = null,
75 routerDelegate = null, 68 routerDelegate = null,
76 backButtonDispatcher = null, 69 backButtonDispatcher = null,
77 super(key: key); 70 super(key: key);
78 71
79 - final GlobalKey<NavigatorState> navigatorKey;  
80 - final Widget home;  
81 - final Map<String, WidgetBuilder> routes;  
82 - final String initialRoute;  
83 - final RouteFactory onGenerateRoute;  
84 - final InitialRouteListFactory onGenerateInitialRoutes;  
85 - final RouteFactory onUnknownRoute;  
86 - final List<NavigatorObserver> navigatorObservers;  
87 - final TransitionBuilder builder; 72 + final GlobalKey<NavigatorState>? navigatorKey;
  73 + final Widget? home;
  74 + final Map<String, WidgetBuilder>? routes;
  75 + final String? initialRoute;
  76 + final RouteFactory? onGenerateRoute;
  77 + final InitialRouteListFactory? onGenerateInitialRoutes;
  78 + final RouteFactory? onUnknownRoute;
  79 + final List<NavigatorObserver>? navigatorObservers;
  80 + final TransitionBuilder? builder;
88 final String title; 81 final String title;
89 - final GenerateAppTitle onGenerateTitle;  
90 - final ThemeData theme;  
91 - final ThemeData darkTheme; 82 + final GenerateAppTitle? onGenerateTitle;
  83 + final ThemeData? theme;
  84 + final ThemeData? darkTheme;
92 final ThemeMode themeMode; 85 final ThemeMode themeMode;
93 - final CustomTransition customTransition;  
94 - final Color color;  
95 - final Map<String, Map<String, String>> translationsKeys;  
96 - final Translations translations;  
97 - final TextDirection textDirection;  
98 - final Locale locale;  
99 - final Locale fallbackLocale;  
100 - final Iterable<LocalizationsDelegate<dynamic>> localizationsDelegates;  
101 - final LocaleListResolutionCallback localeListResolutionCallback;  
102 - final LocaleResolutionCallback localeResolutionCallback; 86 + final CustomTransition? customTransition;
  87 + final Color? color;
  88 + final Map<String, Map<String, String>>? translationsKeys;
  89 + final Translations? translations;
  90 + final TextDirection? textDirection;
  91 + final Locale? locale;
  92 + final Locale? fallbackLocale;
  93 + final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates;
  94 + final LocaleListResolutionCallback? localeListResolutionCallback;
  95 + final LocaleResolutionCallback? localeResolutionCallback;
103 final Iterable<Locale> supportedLocales; 96 final Iterable<Locale> supportedLocales;
104 final bool showPerformanceOverlay; 97 final bool showPerformanceOverlay;
105 final bool checkerboardRasterCacheImages; 98 final bool checkerboardRasterCacheImages;
106 final bool checkerboardOffscreenLayers; 99 final bool checkerboardOffscreenLayers;
107 final bool showSemanticsDebugger; 100 final bool showSemanticsDebugger;
108 final bool debugShowCheckedModeBanner; 101 final bool debugShowCheckedModeBanner;
109 - final Map<LogicalKeySet, Intent> shortcuts;  
110 - final ThemeData highContrastTheme;  
111 - final ThemeData highContrastDarkTheme;  
112 - final Map<Type, Action<Intent>> actions; 102 + final Map<LogicalKeySet, Intent>? shortcuts;
  103 + final ThemeData? highContrastTheme;
  104 + final ThemeData? highContrastDarkTheme;
  105 + final Map<Type, Action<Intent>>? actions;
113 final bool debugShowMaterialGrid; 106 final bool debugShowMaterialGrid;
114 - final ValueChanged<Routing> routingCallback;  
115 - final Transition defaultTransition;  
116 - final bool opaqueRoute;  
117 - final VoidCallback onInit;  
118 - final VoidCallback onReady;  
119 - final VoidCallback onDispose;  
120 - final bool enableLog;  
121 - final LogWriterCallback logWriterCallback;  
122 - final bool popGesture; 107 + final ValueChanged<Routing?>? routingCallback;
  108 + final Transition? defaultTransition;
  109 + final bool? opaqueRoute;
  110 + final VoidCallback? onInit;
  111 + final VoidCallback? onReady;
  112 + final VoidCallback? onDispose;
  113 + final bool? enableLog;
  114 + final LogWriterCallback? logWriterCallback;
  115 + final bool? popGesture;
123 final SmartManagement smartManagement; 116 final SmartManagement smartManagement;
124 - final Bindings initialBinding;  
125 - final Duration transitionDuration;  
126 - final bool defaultGlobalState;  
127 - final List<GetPage> getPages;  
128 - final GetPage unknownRoute;  
129 - final RouteInformationProvider routeInformationProvider;  
130 - final RouteInformationParser<Object> routeInformationParser;  
131 - final RouterDelegate<Object> routerDelegate;  
132 - final BackButtonDispatcher backButtonDispatcher; 117 + final Bindings? initialBinding;
  118 + final Duration? transitionDuration;
  119 + final bool? defaultGlobalState;
  120 + final List<GetPage>? getPages;
  121 + final GetPage? unknownRoute;
  122 + final RouteInformationProvider? routeInformationProvider;
  123 + final RouteInformationParser<Object>? routeInformationParser;
  124 + final RouterDelegate<Object>? routerDelegate;
  125 + final BackButtonDispatcher? backButtonDispatcher;
133 126
134 const GetMaterialApp.router({ 127 const GetMaterialApp.router({
135 - Key key, 128 + Key? key,
136 this.routeInformationProvider, 129 this.routeInformationProvider,
137 - @required this.routeInformationParser,  
138 - @required this.routerDelegate, 130 + required RouteInformationParser<Object> this.routeInformationParser,
  131 + required RouterDelegate<Object> this.routerDelegate,
139 this.backButtonDispatcher, 132 this.backButtonDispatcher,
140 this.builder, 133 this.builder,
141 this.title = '', 134 this.title = '',
@@ -179,16 +172,7 @@ class GetMaterialApp extends StatelessWidget { @@ -179,16 +172,7 @@ class GetMaterialApp extends StatelessWidget {
179 this.defaultGlobalState, 172 this.defaultGlobalState,
180 this.getPages, 173 this.getPages,
181 this.unknownRoute, 174 this.unknownRoute,
182 - }) : assert(routeInformationParser != null),  
183 - assert(routerDelegate != null),  
184 - assert(title != null),  
185 - assert(debugShowMaterialGrid != null),  
186 - assert(showPerformanceOverlay != null),  
187 - assert(checkerboardRasterCacheImages != null),  
188 - assert(checkerboardOffscreenLayers != null),  
189 - assert(showSemanticsDebugger != null),  
190 - assert(debugShowCheckedModeBanner != null),  
191 - navigatorObservers = null, 175 + }) : navigatorObservers = null,
192 navigatorKey = null, 176 navigatorKey = null,
193 onGenerateRoute = null, 177 onGenerateRoute = null,
194 home = null, 178 home = null,
@@ -211,7 +195,7 @@ class GetMaterialApp extends StatelessWidget { @@ -211,7 +195,7 @@ class GetMaterialApp extends StatelessWidget {
211 onDispose?.call(); 195 onDispose?.call();
212 }, 196 },
213 initState: (i) { 197 initState: (i) {
214 - Get.engine.addPostFrameCallback((timeStamp) { 198 + Get.engine!.addPostFrameCallback((timeStamp) {
215 onReady?.call(); 199 onReady?.call();
216 }); 200 });
217 if (locale != null) Get.locale = locale; 201 if (locale != null) Get.locale = locale;
@@ -219,9 +203,9 @@ class GetMaterialApp extends StatelessWidget { @@ -219,9 +203,9 @@ class GetMaterialApp extends StatelessWidget {
219 if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale; 203 if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale;
220 204
221 if (translations != null) { 205 if (translations != null) {
222 - Get.addTranslations(translations.keys); 206 + Get.addTranslations(translations!.keys);
223 } else if (translationsKeys != null) { 207 } else if (translationsKeys != null) {
224 - Get.addTranslations(translationsKeys); 208 + Get.addTranslations(translationsKeys!);
225 } 209 }
226 210
227 Get.customTransition = customTransition; 211 Get.customTransition = customTransition;
@@ -243,8 +227,8 @@ class GetMaterialApp extends StatelessWidget { @@ -243,8 +227,8 @@ class GetMaterialApp extends StatelessWidget {
243 }, 227 },
244 builder: (_) => routerDelegate != null 228 builder: (_) => routerDelegate != null
245 ? MaterialApp.router( 229 ? MaterialApp.router(
246 - routerDelegate: routerDelegate,  
247 - routeInformationParser: routeInformationParser, 230 + routerDelegate: routerDelegate!,
  231 + routeInformationParser: routeInformationParser!,
248 backButtonDispatcher: backButtonDispatcher, 232 backButtonDispatcher: backButtonDispatcher,
249 routeInformationProvider: routeInformationProvider, 233 routeInformationProvider: routeInformationProvider,
250 key: _.unikey, 234 key: _.unikey,
@@ -254,28 +238,26 @@ class GetMaterialApp extends StatelessWidget { @@ -254,28 +238,26 @@ class GetMaterialApp extends StatelessWidget {
254 (rtlLanguages.contains(Get.locale?.languageCode) 238 (rtlLanguages.contains(Get.locale?.languageCode)
255 ? TextDirection.rtl 239 ? TextDirection.rtl
256 : TextDirection.ltr), 240 : TextDirection.ltr),
257 - child: builder == null ? child : builder(context, child), 241 + child: builder == null ? child! : builder!(context, child),
258 ); 242 );
259 }, 243 },
260 - title: title ?? '', 244 + title: title,
261 onGenerateTitle: onGenerateTitle, 245 onGenerateTitle: onGenerateTitle,
262 color: color, 246 color: color,
263 theme: _.theme ?? theme ?? ThemeData.fallback(), 247 theme: _.theme ?? theme ?? ThemeData.fallback(),
264 darkTheme: darkTheme, 248 darkTheme: darkTheme,
265 - themeMode: _.themeMode ?? themeMode ?? ThemeMode.system, 249 + themeMode: _.themeMode ?? themeMode,
266 locale: Get.locale ?? locale, 250 locale: Get.locale ?? locale,
267 localizationsDelegates: localizationsDelegates, 251 localizationsDelegates: localizationsDelegates,
268 localeListResolutionCallback: localeListResolutionCallback, 252 localeListResolutionCallback: localeListResolutionCallback,
269 localeResolutionCallback: localeResolutionCallback, 253 localeResolutionCallback: localeResolutionCallback,
270 - supportedLocales:  
271 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
272 - debugShowMaterialGrid: debugShowMaterialGrid ?? false,  
273 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
274 - checkerboardRasterCacheImages:  
275 - checkerboardRasterCacheImages ?? false,  
276 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
277 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
278 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, 254 + supportedLocales: supportedLocales,
  255 + debugShowMaterialGrid: debugShowMaterialGrid,
  256 + showPerformanceOverlay: showPerformanceOverlay,
  257 + checkerboardRasterCacheImages: checkerboardRasterCacheImages,
  258 + checkerboardOffscreenLayers: checkerboardOffscreenLayers,
  259 + showSemanticsDebugger: showSemanticsDebugger,
  260 + debugShowCheckedModeBanner: debugShowCheckedModeBanner,
279 shortcuts: shortcuts, 261 shortcuts: shortcuts,
280 ) 262 )
281 : MaterialApp( 263 : MaterialApp(
@@ -297,35 +279,33 @@ class GetMaterialApp extends StatelessWidget { @@ -297,35 +279,33 @@ class GetMaterialApp extends StatelessWidget {
297 : <NavigatorObserver>[ 279 : <NavigatorObserver>[
298 GetObserver(routingCallback, Get.routing) 280 GetObserver(routingCallback, Get.routing)
299 ] 281 ]
300 - ..addAll(navigatorObservers)), 282 + ..addAll(navigatorObservers!)),
301 builder: (context, child) { 283 builder: (context, child) {
302 return Directionality( 284 return Directionality(
303 textDirection: textDirection ?? 285 textDirection: textDirection ??
304 (rtlLanguages.contains(Get.locale?.languageCode) 286 (rtlLanguages.contains(Get.locale?.languageCode)
305 ? TextDirection.rtl 287 ? TextDirection.rtl
306 : TextDirection.ltr), 288 : TextDirection.ltr),
307 - child: builder == null ? child : builder(context, child), 289 + child: builder == null ? child! : builder!(context, child),
308 ); 290 );
309 }, 291 },
310 - title: title ?? '', 292 + title: title,
311 onGenerateTitle: onGenerateTitle, 293 onGenerateTitle: onGenerateTitle,
312 color: color, 294 color: color,
313 theme: _.theme ?? theme ?? ThemeData.fallback(), 295 theme: _.theme ?? theme ?? ThemeData.fallback(),
314 darkTheme: darkTheme, 296 darkTheme: darkTheme,
315 - themeMode: _.themeMode ?? themeMode ?? ThemeMode.system, 297 + themeMode: _.themeMode ?? themeMode,
316 locale: Get.locale ?? locale, 298 locale: Get.locale ?? locale,
317 localizationsDelegates: localizationsDelegates, 299 localizationsDelegates: localizationsDelegates,
318 localeListResolutionCallback: localeListResolutionCallback, 300 localeListResolutionCallback: localeListResolutionCallback,
319 localeResolutionCallback: localeResolutionCallback, 301 localeResolutionCallback: localeResolutionCallback,
320 - supportedLocales:  
321 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
322 - debugShowMaterialGrid: debugShowMaterialGrid ?? false,  
323 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
324 - checkerboardRasterCacheImages:  
325 - checkerboardRasterCacheImages ?? false,  
326 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
327 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
328 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, 302 + supportedLocales: supportedLocales,
  303 + debugShowMaterialGrid: debugShowMaterialGrid,
  304 + showPerformanceOverlay: showPerformanceOverlay,
  305 + checkerboardRasterCacheImages: checkerboardRasterCacheImages,
  306 + checkerboardOffscreenLayers: checkerboardOffscreenLayers,
  307 + showSemanticsDebugger: showSemanticsDebugger,
  308 + debugShowCheckedModeBanner: debugShowCheckedModeBanner,
329 shortcuts: shortcuts, 309 shortcuts: shortcuts,
330 // actions: actions, 310 // actions: actions,
331 )); 311 ));
1 import '../../../get_core/src/get_main.dart'; 1 import '../../../get_core/src/get_main.dart';
2 -  
3 import '../../get_navigation.dart'; 2 import '../../get_navigation.dart';
4 import '../routes/get_route.dart'; 3 import '../routes/get_route.dart';
5 4
6 class RouteDecoder { 5 class RouteDecoder {
7 - final GetPage route;  
8 - final Map<String, String> parameters; 6 + final GetPage? route;
  7 + final Map<String, String?> parameters;
9 const RouteDecoder(this.route, this.parameters); 8 const RouteDecoder(this.route, this.parameters);
10 } 9 }
11 10
@@ -15,10 +14,10 @@ class ParseRouteTree { @@ -15,10 +14,10 @@ class ParseRouteTree {
15 RouteDecoder matchRoute(String name) { 14 RouteDecoder matchRoute(String name) {
16 final uri = Uri.parse(name); 15 final uri = Uri.parse(name);
17 final route = _findRoute(uri.path); 16 final route = _findRoute(uri.path);
18 - final params = Map<String, String>.from(uri.queryParameters); 17 + final params = Map<String, String?>.from(uri.queryParameters);
19 if (route != null) { 18 if (route != null) {
20 final parsedParams = _parseParams(name, route.path); 19 final parsedParams = _parseParams(name, route.path);
21 - if (parsedParams != null && parsedParams.isNotEmpty) { 20 + if (parsedParams.isNotEmpty) {
22 params.addAll(parsedParams); 21 params.addAll(parsedParams);
23 } 22 }
24 } else { 23 } else {
@@ -45,12 +44,12 @@ class ParseRouteTree { @@ -45,12 +44,12 @@ class ParseRouteTree {
45 44
46 List<GetPage> _flattenPage(GetPage route) { 45 List<GetPage> _flattenPage(GetPage route) {
47 final result = <GetPage>[]; 46 final result = <GetPage>[];
48 - if (route.children == null || route.children.isEmpty) { 47 + if (route.children == null || route.children!.isEmpty) {
49 return result; 48 return result;
50 } 49 }
51 50
52 final parentPath = route.name; 51 final parentPath = route.name;
53 - for (var page in route.children) { 52 + for (var page in route.children!) {
54 // Add Parent middlewares to children 53 // Add Parent middlewares to children
55 final pageMiddlewares = page.middlewares ?? <GetMiddleware>[]; 54 final pageMiddlewares = page.middlewares ?? <GetMiddleware>[];
56 pageMiddlewares.addAll(route.middlewares ?? <GetMiddleware>[]); 55 pageMiddlewares.addAll(route.middlewares ?? <GetMiddleware>[]);
@@ -88,15 +87,15 @@ class ParseRouteTree { @@ -88,15 +87,15 @@ class ParseRouteTree {
88 middlewares: middlewares, 87 middlewares: middlewares,
89 ); 88 );
90 89
91 - GetPage _findRoute(String name) {  
92 - return _routes.firstWhere( 90 + GetPage? _findRoute(String name) {
  91 + return _routes.firstWhereOrNull(
93 (route) => route.path.regex.hasMatch(name), 92 (route) => route.path.regex.hasMatch(name),
94 - orElse: () => null,  
95 ); 93 );
96 } 94 }
97 95
98 - Map<String, String> _parseParams(String path, PathDecoded routePath) {  
99 - final params = <String, String>{}; 96 +
  97 + Map<String, String?> _parseParams(String path, PathDecoded routePath) {
  98 + final params = <String, String?>{};
100 var idx = path.indexOf('?'); 99 var idx = path.indexOf('?');
101 if (idx > -1) { 100 if (idx > -1) {
102 path = path.substring(0, idx); 101 path = path.substring(0, idx);
@@ -104,10 +103,21 @@ class ParseRouteTree { @@ -104,10 +103,21 @@ class ParseRouteTree {
104 params.addAll(uri.queryParameters); 103 params.addAll(uri.queryParameters);
105 } 104 }
106 Match paramsMatch = routePath.regex.firstMatch(path); 105 Match paramsMatch = routePath.regex.firstMatch(path);
  106 +
107 for (var i = 0; i < routePath.keys.length; i++) { 107 for (var i = 0; i < routePath.keys.length; i++) {
108 - var param = Uri.decodeQueryComponent(paramsMatch[i + 1]);  
109 - params[routePath.keys[i]] = param; 108 + var param = Uri.decodeQueryComponent(paramsMatch![i + 1]!);
  109 + params[routePath.keys[i]!] = param;
110 } 110 }
111 return params; 111 return params;
112 } 112 }
113 } 113 }
  114 +
  115 +extension FirstWhereExt<T> on List<T> {
  116 + /// The first element satisfying [test], or `null` if there are none.
  117 + T? firstWhereOrNull(bool Function(T element) test) {
  118 + for (var element in this) {
  119 + if (test(element)) return element;
  120 + }
  121 + return null;
  122 + }
  123 +}
@@ -8,14 +8,14 @@ import 'parse_route.dart'; @@ -8,14 +8,14 @@ import 'parse_route.dart';
8 8
9 class GetMaterialController extends GetxController { 9 class GetMaterialController extends GetxController {
10 bool testMode = false; 10 bool testMode = false;
11 - Key unikey;  
12 - ThemeData theme;  
13 - ThemeMode themeMode; 11 + Key? unikey;
  12 + ThemeData? theme;
  13 + ThemeMode? themeMode;
14 14
15 bool defaultPopGesture = GetPlatform.isIOS; 15 bool defaultPopGesture = GetPlatform.isIOS;
16 bool defaultOpaqueRoute = true; 16 bool defaultOpaqueRoute = true;
17 17
18 - Transition defaultTransition; 18 + Transition? defaultTransition;
19 Duration defaultTransitionDuration = Duration(milliseconds: 300); 19 Duration defaultTransitionDuration = Duration(milliseconds: 300);
20 Curve defaultTransitionCurve = Curves.easeOutQuad; 20 Curve defaultTransitionCurve = Curves.easeOutQuad;
21 21
@@ -25,13 +25,13 @@ class GetMaterialController extends GetxController { @@ -25,13 +25,13 @@ class GetMaterialController extends GetxController {
25 25
26 final routing = Routing(); 26 final routing = Routing();
27 27
28 - Map<String, String> parameters = {}; 28 + Map<String, String?> parameters = {};
29 29
30 - ParseRouteTree routeTree; 30 + late ParseRouteTree routeTree;
31 31
32 - CustomTransition customTransition; 32 + CustomTransition? customTransition;
33 33
34 - GlobalKey<NavigatorState> key = GlobalKey<NavigatorState>(); 34 + GlobalKey<NavigatorState>? key = GlobalKey<NavigatorState>();
35 35
36 Map<int, GlobalKey<NavigatorState>> keys = {}; 36 Map<int, GlobalKey<NavigatorState>> keys = {};
37 37
@@ -4,8 +4,8 @@ import 'package:flutter/widgets.dart'; @@ -4,8 +4,8 @@ import 'package:flutter/widgets.dart';
4 abstract class CustomTransition { 4 abstract class CustomTransition {
5 Widget buildTransition( 5 Widget buildTransition(
6 BuildContext context, 6 BuildContext context,
7 - Curve curve,  
8 - Alignment alignment, 7 + Curve? curve,
  8 + Alignment? alignment,
9 Animation<double> animation, 9 Animation<double> animation,
10 Animation<double> secondaryAnimation, 10 Animation<double> secondaryAnimation,
11 Widget child, 11 Widget child,
@@ -12,7 +12,7 @@ import 'transitions_type.dart'; @@ -12,7 +12,7 @@ import 'transitions_type.dart';
12 12
13 class GetPageRoute<T> extends PageRoute<T> { 13 class GetPageRoute<T> extends PageRoute<T> {
14 GetPageRoute({ 14 GetPageRoute({
15 - RouteSettings settings, 15 + RouteSettings? settings,
16 this.transitionDuration = const Duration(milliseconds: 300), 16 this.transitionDuration = const Duration(milliseconds: 300),
17 this.opaque = true, 17 this.opaque = true,
18 this.parameter, 18 this.parameter,
@@ -31,51 +31,47 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -31,51 +31,47 @@ 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
42 final Duration transitionDuration; 38 final Duration transitionDuration;
43 39
44 - final GetPageBuilder page; 40 + final GetPageBuilder? page;
45 41
46 - final String routeName; 42 + final String? routeName;
47 43
48 final String reference; 44 final String reference;
49 45
50 - final CustomTransition customTransition; 46 + final CustomTransition? customTransition;
51 47
52 - final Bindings binding; 48 + final Bindings? binding;
53 49
54 - final Map<String, String> parameter; 50 + final Map<String, String>? parameter;
55 51
56 - final List<Bindings> bindings; 52 + final List<Bindings>? bindings;
57 53
58 @override 54 @override
59 final bool opaque; 55 final bool opaque;
60 56
61 - final bool popGesture; 57 + final bool? popGesture;
62 58
63 @override 59 @override
64 final bool barrierDismissible; 60 final bool barrierDismissible;
65 61
66 - final Transition transition; 62 + final Transition? transition;
67 63
68 - final Curve curve; 64 + final Curve? curve;
69 65
70 - final Alignment alignment; 66 + final Alignment? alignment;
71 67
72 - final List<GetMiddleware> middlewares; 68 + final List<GetMiddleware>? middlewares;
73 69
74 @override 70 @override
75 - final Color barrierColor; 71 + final Color? barrierColor;
76 72
77 @override 73 @override
78 - final String barrierLabel; 74 + final String? barrierLabel;
79 75
80 @override 76 @override
81 final bool maintainState; 77 final bool maintainState;
@@ -93,8 +89,8 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -93,8 +89,8 @@ class GetPageRoute<T> extends PageRoute<T> {
93 route.willHandlePopInternally || 89 route.willHandlePopInternally ||
94 route.hasScopedWillPopCallback || 90 route.hasScopedWillPopCallback ||
95 route.fullscreenDialog || 91 route.fullscreenDialog ||
96 - route.animation.status != AnimationStatus.completed ||  
97 - route.secondaryAnimation.status != AnimationStatus.dismissed || 92 + route.animation!.status != AnimationStatus.completed ||
  93 + route.secondaryAnimation!.status != AnimationStatus.dismissed ||
98 isPopGestureInProgress(route)) return false; 94 isPopGestureInProgress(route)) return false;
99 95
100 return true; 96 return true;
@@ -105,8 +101,8 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -105,8 +101,8 @@ class GetPageRoute<T> extends PageRoute<T> {
105 assert(_isPopGestureEnabled(route)); 101 assert(_isPopGestureEnabled(route));
106 102
107 return _CupertinoBackGestureController<T>( 103 return _CupertinoBackGestureController<T>(
108 - navigator: route.navigator,  
109 - controller: route.controller, 104 + navigator: route.navigator!,
  105 + controller: route.controller!,
110 ); 106 );
111 } 107 }
112 108
@@ -129,12 +125,12 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -129,12 +125,12 @@ class GetPageRoute<T> extends PageRoute<T> {
129 } 125 }
130 } 126 }
131 127
132 - final pageToBuild = middlewareRunner.runOnPageBuildStart(page); 128 + final pageToBuild = middlewareRunner.runOnPageBuildStart(page)!;
133 return middlewareRunner.runOnPageBuilt(pageToBuild()); 129 return middlewareRunner.runOnPageBuilt(pageToBuild());
134 } 130 }
135 131
136 static bool isPopGestureInProgress(PageRoute<dynamic> route) { 132 static bool isPopGestureInProgress(PageRoute<dynamic> route) {
137 - return route.navigator.userGestureInProgress; 133 + return route.navigator!.userGestureInProgress;
138 } 134 }
139 135
140 bool get popGestureInProgress => isPopGestureInProgress(this); 136 bool get popGestureInProgress => isPopGestureInProgress(this);
@@ -156,7 +152,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -156,7 +152,7 @@ class GetPageRoute<T> extends PageRoute<T> {
156 linearTransition: hasCurve); 152 linearTransition: hasCurve);
157 } 153 }
158 if (customTransition != null) { 154 if (customTransition != null) {
159 - return customTransition.buildTransition( 155 + return customTransition!.buildTransition(
160 context, 156 context,
161 finalCurve, 157 finalCurve,
162 alignment, 158 alignment,
@@ -312,7 +308,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -312,7 +308,7 @@ class GetPageRoute<T> extends PageRoute<T> {
312 case Transition.size: 308 case Transition.size:
313 return SizeTransitions().buildTransitions( 309 return SizeTransitions().buildTransitions(
314 context, 310 context,
315 - curve, 311 + curve!,
316 alignment, 312 alignment,
317 animation, 313 animation,
318 secondaryAnimation, 314 secondaryAnimation,
@@ -364,7 +360,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -364,7 +360,7 @@ class GetPageRoute<T> extends PageRoute<T> {
364 360
365 default: 361 default:
366 if (Get.customTransition != null) { 362 if (Get.customTransition != null) {
367 - return Get.customTransition.buildTransition( 363 + return Get.customTransition!.buildTransition(
368 context, curve, alignment, animation, secondaryAnimation, child); 364 context, curve, alignment, animation, secondaryAnimation, child);
369 } 365 }
370 366
@@ -386,7 +382,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -386,7 +382,7 @@ class GetPageRoute<T> extends PageRoute<T> {
386 void dispose() { 382 void dispose() {
387 super.dispose(); 383 super.dispose();
388 if (Get.smartManagement != SmartManagement.onlyBuilder) { 384 if (Get.smartManagement != SmartManagement.onlyBuilder) {
389 - WidgetsBinding.instance.addPostFrameCallback((_) { 385 + WidgetsBinding.instance!.addPostFrameCallback((_) {
390 if (Get.reference != reference) { 386 if (Get.reference != reference) {
391 GetInstance().removeDependencyByRoute("$reference"); 387 GetInstance().removeDependencyByRoute("$reference");
392 } 388 }
@@ -412,14 +408,11 @@ const int _kMaxPageBackAnimationTime = 300; @@ -412,14 +408,11 @@ const int _kMaxPageBackAnimationTime = 300;
412 408
413 class _CupertinoBackGestureDetector<T> extends StatefulWidget { 409 class _CupertinoBackGestureDetector<T> extends StatefulWidget {
414 const _CupertinoBackGestureDetector({ 410 const _CupertinoBackGestureDetector({
415 - Key key,  
416 - @required this.enabledCallback,  
417 - @required this.onStartPopGesture,  
418 - @required this.child,  
419 - }) : assert(enabledCallback != null),  
420 - assert(onStartPopGesture != null),  
421 - assert(child != null),  
422 - super(key: key); 411 + Key? key,
  412 + required this.enabledCallback,
  413 + required this.onStartPopGesture,
  414 + required this.child,
  415 + }) : super(key: key);
423 416
424 final Widget child; 417 final Widget child;
425 418
@@ -434,9 +427,9 @@ class _CupertinoBackGestureDetector<T> extends StatefulWidget { @@ -434,9 +427,9 @@ class _CupertinoBackGestureDetector<T> extends StatefulWidget {
434 427
435 class _CupertinoBackGestureDetectorState<T> 428 class _CupertinoBackGestureDetectorState<T>
436 extends State<_CupertinoBackGestureDetector<T>> { 429 extends State<_CupertinoBackGestureDetector<T>> {
437 - _CupertinoBackGestureController<T> _backGestureController; 430 + _CupertinoBackGestureController<T>? _backGestureController;
438 431
439 - HorizontalDragGestureRecognizer _recognizer; 432 + late HorizontalDragGestureRecognizer _recognizer;
440 433
441 @override 434 @override
442 void initState() { 435 void initState() {
@@ -463,15 +456,15 @@ class _CupertinoBackGestureDetectorState<T> @@ -463,15 +456,15 @@ class _CupertinoBackGestureDetectorState<T>
463 void _handleDragUpdate(DragUpdateDetails details) { 456 void _handleDragUpdate(DragUpdateDetails details) {
464 assert(mounted); 457 assert(mounted);
465 assert(_backGestureController != null); 458 assert(_backGestureController != null);
466 - _backGestureController.dragUpdate(  
467 - _convertToLogical(details.primaryDelta / context.size.width)); 459 + _backGestureController!.dragUpdate(
  460 + _convertToLogical(details.primaryDelta! / context.size!.width)!);
468 } 461 }
469 462
470 void _handleDragEnd(DragEndDetails details) { 463 void _handleDragEnd(DragEndDetails details) {
471 assert(mounted); 464 assert(mounted);
472 assert(_backGestureController != null); 465 assert(_backGestureController != null);
473 - _backGestureController.dragEnd(_convertToLogical(  
474 - details.velocity.pixelsPerSecond.dx / context.size.width)); 466 + _backGestureController!.dragEnd(_convertToLogical(
  467 + details.velocity.pixelsPerSecond.dx / context.size!.width)!);
475 _backGestureController = null; 468 _backGestureController = null;
476 } 469 }
477 470
@@ -487,17 +480,15 @@ class _CupertinoBackGestureDetectorState<T> @@ -487,17 +480,15 @@ class _CupertinoBackGestureDetectorState<T>
487 if (widget.enabledCallback()) _recognizer.addPointer(event); 480 if (widget.enabledCallback()) _recognizer.addPointer(event);
488 } 481 }
489 482
490 - double _convertToLogical(double value) { 483 + double? _convertToLogical(double value) {
491 switch (Directionality.of(context)) { 484 switch (Directionality.of(context)) {
492 case TextDirection.rtl: 485 case TextDirection.rtl:
493 return -value; 486 return -value;
494 case TextDirection.ltr: 487 case TextDirection.ltr:
495 return value; 488 return value;
  489 + default:
  490 + return value;
496 } 491 }
497 - // FIXME: shouldn't we return a default here?  
498 - // or perhaps throw error  
499 - // ignore: avoid_returning_null  
500 - return null;  
501 } 492 }
502 493
503 @override 494 @override
@@ -533,10 +524,9 @@ class _CupertinoBackGestureController<T> { @@ -533,10 +524,9 @@ class _CupertinoBackGestureController<T> {
533 /// 524 ///
534 /// The [navigator] and [controller] arguments must not be null. 525 /// The [navigator] and [controller] arguments must not be null.
535 _CupertinoBackGestureController({ 526 _CupertinoBackGestureController({
536 - @required this.navigator,  
537 - @required this.controller,  
538 - }) : assert(navigator != null),  
539 - assert(controller != null) { 527 + required this.navigator,
  528 + required this.controller,
  529 + }) {
540 navigator.didStartUserGesture(); 530 navigator.didStartUserGesture();
541 } 531 }
542 532
@@ -579,7 +569,8 @@ class _CupertinoBackGestureController<T> { @@ -579,7 +569,8 @@ class _CupertinoBackGestureController<T> {
579 _kMaxDroppedSwipePageForwardAnimationTime, 569 _kMaxDroppedSwipePageForwardAnimationTime,
580 0, 570 0,
581 controller.value, 571 controller.value,
582 - ).floor(), 572 + )!
  573 + .floor(),
583 _kMaxPageBackAnimationTime, 574 _kMaxPageBackAnimationTime,
584 ); 575 );
585 controller.animateTo(1.0, 576 controller.animateTo(1.0,
@@ -597,7 +588,8 @@ class _CupertinoBackGestureController<T> { @@ -597,7 +588,8 @@ class _CupertinoBackGestureController<T> {
597 0, 588 0,
598 _kMaxDroppedSwipePageForwardAnimationTime, 589 _kMaxDroppedSwipePageForwardAnimationTime,
599 controller.value, 590 controller.value,
600 - ).floor(); 591 + )!
  592 + .floor();
601 controller.animateBack( 593 controller.animateBack(
602 0.0, 594 0.0,
603 duration: Duration(milliseconds: droppedPageBackAnimationTime), 595 duration: Duration(milliseconds: droppedPageBackAnimationTime),
@@ -610,7 +602,7 @@ class _CupertinoBackGestureController<T> { @@ -610,7 +602,7 @@ class _CupertinoBackGestureController<T> {
610 // Keep the userGestureInProgress in true state so we don't change the 602 // Keep the userGestureInProgress in true state so we don't change the
611 // curve of the page transition mid-flight since CupertinoPageTransition 603 // curve of the page transition mid-flight since CupertinoPageTransition
612 // depends on userGestureInProgress. 604 // depends on userGestureInProgress.
613 - AnimationStatusListener animationStatusCallback; 605 + late AnimationStatusListener animationStatusCallback;
614 animationStatusCallback = (status) { 606 animationStatusCallback = (status) {
615 navigator.didStopUserGesture(); 607 navigator.didStopUserGesture();
616 controller.removeStatusListener(animationStatusCallback); 608 controller.removeStatusListener(animationStatusCallback);
@@ -4,8 +4,8 @@ import 'package:flutter/material.dart'; @@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
4 class LeftToRightFadeTransition { 4 class LeftToRightFadeTransition {
5 Widget buildTransitions( 5 Widget buildTransitions(
6 BuildContext context, 6 BuildContext context,
7 - Curve curve,  
8 - Alignment alignment, 7 + Curve? curve,
  8 + Alignment? alignment,
9 Animation<double> animation, 9 Animation<double> animation,
10 Animation<double> secondaryAnimation, 10 Animation<double> secondaryAnimation,
11 Widget child) { 11 Widget child) {
@@ -30,8 +30,8 @@ class LeftToRightFadeTransition { @@ -30,8 +30,8 @@ class LeftToRightFadeTransition {
30 class RightToLeftFadeTransition { 30 class RightToLeftFadeTransition {
31 Widget buildTransitions( 31 Widget buildTransitions(
32 BuildContext context, 32 BuildContext context,
33 - Curve curve,  
34 - Alignment alignment, 33 + Curve? curve,
  34 + Alignment? alignment,
35 Animation<double> animation, 35 Animation<double> animation,
36 Animation<double> secondaryAnimation, 36 Animation<double> secondaryAnimation,
37 Widget child) { 37 Widget child) {
@@ -68,8 +68,8 @@ class NoTransition { @@ -68,8 +68,8 @@ class NoTransition {
68 class FadeInTransition { 68 class FadeInTransition {
69 Widget buildTransitions( 69 Widget buildTransitions(
70 BuildContext context, 70 BuildContext context,
71 - Curve curve,  
72 - Alignment alignment, 71 + Curve? curve,
  72 + Alignment? alignment,
73 Animation<double> animation, 73 Animation<double> animation,
74 Animation<double> secondaryAnimation, 74 Animation<double> secondaryAnimation,
75 Widget child) { 75 Widget child) {
@@ -80,8 +80,8 @@ class FadeInTransition { @@ -80,8 +80,8 @@ class FadeInTransition {
80 class SlideDownTransition { 80 class SlideDownTransition {
81 Widget buildTransitions( 81 Widget buildTransitions(
82 BuildContext context, 82 BuildContext context,
83 - Curve curve,  
84 - Alignment alignment, 83 + Curve? curve,
  84 + Alignment? alignment,
85 Animation<double> animation, 85 Animation<double> animation,
86 Animation<double> secondaryAnimation, 86 Animation<double> secondaryAnimation,
87 Widget child) { 87 Widget child) {
@@ -98,8 +98,8 @@ class SlideDownTransition { @@ -98,8 +98,8 @@ class SlideDownTransition {
98 class SlideLeftTransition { 98 class SlideLeftTransition {
99 Widget buildTransitions( 99 Widget buildTransitions(
100 BuildContext context, 100 BuildContext context,
101 - Curve curve,  
102 - Alignment alignment, 101 + Curve? curve,
  102 + Alignment? alignment,
103 Animation<double> animation, 103 Animation<double> animation,
104 Animation<double> secondaryAnimation, 104 Animation<double> secondaryAnimation,
105 Widget child) { 105 Widget child) {
@@ -116,8 +116,8 @@ class SlideLeftTransition { @@ -116,8 +116,8 @@ class SlideLeftTransition {
116 class SlideRightTransition { 116 class SlideRightTransition {
117 Widget buildTransitions( 117 Widget buildTransitions(
118 BuildContext context, 118 BuildContext context,
119 - Curve curve,  
120 - Alignment alignment, 119 + Curve? curve,
  120 + Alignment? alignment,
121 Animation<double> animation, 121 Animation<double> animation,
122 Animation<double> secondaryAnimation, 122 Animation<double> secondaryAnimation,
123 Widget child) { 123 Widget child) {
@@ -134,8 +134,8 @@ class SlideRightTransition { @@ -134,8 +134,8 @@ class SlideRightTransition {
134 class SlideTopTransition { 134 class SlideTopTransition {
135 Widget buildTransitions( 135 Widget buildTransitions(
136 BuildContext context, 136 BuildContext context,
137 - Curve curve,  
138 - Alignment alignment, 137 + Curve? curve,
  138 + Alignment? alignment,
139 Animation<double> animation, 139 Animation<double> animation,
140 Animation<double> secondaryAnimation, 140 Animation<double> secondaryAnimation,
141 Widget child) { 141 Widget child) {
@@ -152,8 +152,8 @@ class SlideTopTransition { @@ -152,8 +152,8 @@ class SlideTopTransition {
152 class ZoomInTransition { 152 class ZoomInTransition {
153 Widget buildTransitions( 153 Widget buildTransitions(
154 BuildContext context, 154 BuildContext context,
155 - Curve curve,  
156 - Alignment alignment, 155 + Curve? curve,
  156 + Alignment? alignment,
157 Animation<double> animation, 157 Animation<double> animation,
158 Animation<double> secondaryAnimation, 158 Animation<double> secondaryAnimation,
159 Widget child) { 159 Widget child) {
@@ -168,7 +168,7 @@ class SizeTransitions { @@ -168,7 +168,7 @@ class SizeTransitions {
168 Widget buildTransitions( 168 Widget buildTransitions(
169 BuildContext context, 169 BuildContext context,
170 Curve curve, 170 Curve curve,
171 - Alignment alignment, 171 + Alignment? alignment,
172 Animation<double> animation, 172 Animation<double> animation,
173 Animation<double> secondaryAnimation, 173 Animation<double> secondaryAnimation,
174 Widget child) { 174 Widget child) {
@@ -8,33 +8,33 @@ import 'transitions_type.dart'; @@ -8,33 +8,33 @@ import 'transitions_type.dart';
8 class PathDecoded { 8 class PathDecoded {
9 const PathDecoded(this.regex, this.keys); 9 const PathDecoded(this.regex, this.keys);
10 final RegExp regex; 10 final RegExp regex;
11 - final List<String> keys; 11 + final List<String?> keys;
12 } 12 }
13 13
14 class GetPage { 14 class GetPage {
15 final String name; 15 final String name;
16 final GetPageBuilder page; 16 final GetPageBuilder page;
17 - final bool popGesture;  
18 - final Map<String, String> parameter;  
19 - final String title;  
20 - final Transition transition; 17 + final bool? popGesture;
  18 + final Map<String, String>? parameter;
  19 + final String? title;
  20 + final Transition? transition;
21 final Curve curve; 21 final Curve curve;
22 - final Alignment alignment; 22 + final Alignment? alignment;
23 final bool maintainState; 23 final bool maintainState;
24 final bool opaque; 24 final bool opaque;
25 - final Bindings binding; 25 + final Bindings? binding;
26 final List<Bindings> bindings; 26 final List<Bindings> bindings;
27 - final CustomTransition customTransition;  
28 - final Duration transitionDuration; 27 + final CustomTransition? customTransition;
  28 + final Duration? transitionDuration;
29 final bool fullscreenDialog; 29 final bool fullscreenDialog;
30 - final RouteSettings settings;  
31 - final List<GetPage> children;  
32 - final List<GetMiddleware> middlewares; 30 + final RouteSettings? settings;
  31 + final List<GetPage>? children;
  32 + final List<GetMiddleware>? middlewares;
33 final PathDecoded path; 33 final PathDecoded path;
34 34
35 GetPage({ 35 GetPage({
36 - @required this.name,  
37 - @required this.page, 36 + required this.name,
  37 + required this.page,
38 this.title, 38 this.title,
39 this.settings, 39 this.settings,
40 this.maintainState = true, 40 this.maintainState = true,
@@ -51,14 +51,10 @@ class GetPage { @@ -51,14 +51,10 @@ 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?>[];
62 58
63 String _replace(Match pattern) { 59 String _replace(Match pattern) {
64 var buffer = StringBuffer('(?:'); 60 var buffer = StringBuffer('(?:');
@@ -79,24 +75,24 @@ class GetPage { @@ -79,24 +75,24 @@ class GetPage {
79 } 75 }
80 76
81 GetPage copyWith({ 77 GetPage copyWith({
82 - String name,  
83 - GetPageBuilder page,  
84 - bool popGesture,  
85 - Map<String, String> parameter,  
86 - String title,  
87 - Transition transition,  
88 - Curve curve,  
89 - Alignment alignment,  
90 - bool maintainState,  
91 - bool opaque,  
92 - Bindings binding,  
93 - List<Bindings> bindings,  
94 - CustomTransition customTransition,  
95 - Duration transitionDuration,  
96 - bool fullscreenDialog,  
97 - RouteSettings settings,  
98 - List<GetPage> children,  
99 - List<GetMiddleware> middlewares, 78 + String? name,
  79 + GetPageBuilder? page,
  80 + bool? popGesture,
  81 + Map<String, String>? parameter,
  82 + String? title,
  83 + Transition? transition,
  84 + Curve? curve,
  85 + Alignment? alignment,
  86 + bool? maintainState,
  87 + bool? opaque,
  88 + Bindings? binding,
  89 + List<Bindings>? bindings,
  90 + CustomTransition? customTransition,
  91 + Duration? transitionDuration,
  92 + bool? fullscreenDialog,
  93 + RouteSettings? settings,
  94 + List<GetPage>? children,
  95 + List<GetMiddleware>? middlewares,
100 }) { 96 }) {
101 return GetPage( 97 return GetPage(
102 name: name ?? this.name, 98 name: name ?? this.name,
@@ -10,11 +10,11 @@ class Routing { @@ -10,11 +10,11 @@ class Routing {
10 String previous; 10 String previous;
11 dynamic args; 11 dynamic args;
12 String removed; 12 String removed;
13 - Route<dynamic> route;  
14 - bool isBack;  
15 - bool isSnackbar;  
16 - bool isBottomSheet;  
17 - bool isDialog; 13 + Route<dynamic>? route;
  14 + bool? isBack;
  15 + bool? isSnackbar;
  16 + bool? isBottomSheet;
  17 + bool? isDialog;
18 18
19 Routing({ 19 Routing({
20 this.current = '', 20 this.current = '',
@@ -35,9 +35,9 @@ class Routing { @@ -35,9 +35,9 @@ class Routing {
35 35
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) {  
39 - if (route?.settings?.name != null) {  
40 - return route.settings.name; 38 +String? _extractRouteName(Route? route) {
  39 + if (route?.settings.name != null) {
  40 + return route!.settings.name;
41 } 41 }
42 42
43 if (route is GetPageRoute) { 43 if (route is GetPageRoute) {
@@ -61,17 +61,17 @@ class _RouteData { @@ -61,17 +61,17 @@ class _RouteData {
61 final bool isSnackbar; 61 final bool isSnackbar;
62 final bool isBottomSheet; 62 final bool isBottomSheet;
63 final bool isDialog; 63 final bool isDialog;
64 - final String name; 64 + final String? name;
65 65
66 _RouteData({ 66 _RouteData({
67 - @required this.name,  
68 - @required this.isGetPageRoute,  
69 - @required this.isSnackbar,  
70 - @required this.isBottomSheet,  
71 - @required this.isDialog, 67 + required this.name,
  68 + required this.isGetPageRoute,
  69 + required this.isSnackbar,
  70 + required this.isBottomSheet,
  71 + required this.isDialog,
72 }); 72 });
73 73
74 - factory _RouteData.ofRoute(Route route) { 74 + factory _RouteData.ofRoute(Route? route) {
75 return _RouteData( 75 return _RouteData(
76 name: _extractRouteName(route), 76 name: _extractRouteName(route),
77 isGetPageRoute: route is GetPageRoute, 77 isGetPageRoute: route is GetPageRoute,
@@ -83,14 +83,14 @@ class _RouteData { @@ -83,14 +83,14 @@ class _RouteData {
83 } 83 }
84 84
85 class GetObserver extends NavigatorObserver { 85 class GetObserver extends NavigatorObserver {
86 - final Function(Routing) routing; 86 + final Function(Routing?)? routing;
87 87
88 GetObserver([this.routing, this._routeSend]); 88 GetObserver([this.routing, this._routeSend]);
89 89
90 - final Routing _routeSend; 90 + final Routing? _routeSend;
91 91
92 @override 92 @override
93 - void didPush(Route route, Route previousRoute) { 93 + void didPush(Route route, Route? previousRoute) {
94 super.didPush(route, previousRoute); 94 super.didPush(route, previousRoute);
95 final newRoute = _RouteData.ofRoute(route); 95 final newRoute = _RouteData.ofRoute(route);
96 96
@@ -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 = '';
@@ -122,12 +122,12 @@ class GetObserver extends NavigatorObserver { @@ -122,12 +122,12 @@ class GetObserver extends NavigatorObserver {
122 }); 122 });
123 123
124 if (routing != null) { 124 if (routing != null) {
125 - routing(_routeSend); 125 + routing!(_routeSend);
126 } 126 }
127 } 127 }
128 128
129 @override 129 @override
130 - void didPop(Route route, Route previousRoute) { 130 + void didPop(Route route, Route? previousRoute) {
131 super.didPop(route, previousRoute); 131 super.didPop(route, previousRoute);
132 final currentRoute = _RouteData.ofRoute(route); 132 final currentRoute = _RouteData.ofRoute(route);
133 final newRoute = _RouteData.ofRoute(previousRoute); 133 final newRoute = _RouteData.ofRoute(previousRoute);
@@ -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 = '';
@@ -167,7 +167,7 @@ class GetObserver extends NavigatorObserver { @@ -167,7 +167,7 @@ class GetObserver extends NavigatorObserver {
167 } 167 }
168 168
169 @override 169 @override
170 - void didReplace({Route newRoute, Route oldRoute}) { 170 + void didReplace({Route? newRoute, Route? oldRoute}) {
171 super.didReplace(newRoute: newRoute, oldRoute: oldRoute); 171 super.didReplace(newRoute: newRoute, oldRoute: oldRoute);
172 final newName = _extractRouteName(newRoute); 172 final newName = _extractRouteName(newRoute);
173 final oldName = _extractRouteName(oldRoute); 173 final oldName = _extractRouteName(oldRoute);
@@ -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 = '';
@@ -198,7 +198,7 @@ class GetObserver extends NavigatorObserver { @@ -198,7 +198,7 @@ class GetObserver extends NavigatorObserver {
198 } 198 }
199 199
200 @override 200 @override
201 - void didRemove(Route route, Route previousRoute) { 201 + void didRemove(Route route, Route? previousRoute) {
202 super.didRemove(route, previousRoute); 202 super.didRemove(route, previousRoute);
203 final routeName = _extractRouteName(route); 203 final routeName = _extractRouteName(route);
204 final currentRoute = _RouteData.ofRoute(route); 204 final currentRoute = _RouteData.ofRoute(route);