Jonny Borges

solving dart migrate errors

Showing 41 changed files with 1011 additions and 1017 deletions

Too many changes to show.

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

@@ -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(
@@ -267,9 +267,9 @@ class GetConnect extends GetConnectInterface { @@ -267,9 +267,9 @@ class GetConnect extends GetConnectInterface {
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';
@@ -20,7 +20,7 @@ typedef Progress = Function(double percent); @@ -20,7 +20,7 @@ typedef Progress = Function(double percent);
20 20
21 class GetHttpClient { 21 class GetHttpClient {
22 String userAgent; 22 String userAgent;
23 - String baseUrl; 23 + String? baseUrl;
24 24
25 String defaultContentType = 'application/json; charset=utf-8'; 25 String defaultContentType = 'application/json; charset=utf-8';
26 26
@@ -28,7 +28,7 @@ class GetHttpClient { @@ -28,7 +28,7 @@ class GetHttpClient {
28 int maxRedirects; 28 int maxRedirects;
29 int maxAuthRetries; 29 int maxAuthRetries;
30 30
31 - Decoder defaultDecoder; 31 + Decoder? defaultDecoder;
32 32
33 Duration timeout; 33 Duration timeout;
34 34
@@ -46,7 +46,7 @@ class GetHttpClient { @@ -46,7 +46,7 @@ class GetHttpClient {
46 this.maxAuthRetries = 1, 46 this.maxAuthRetries = 1,
47 bool allowAutoSignedCert = false, 47 bool allowAutoSignedCert = false,
48 this.baseUrl, 48 this.baseUrl,
49 - List<TrustedCertificate> trustedCertificates, 49 + List<TrustedCertificate>? trustedCertificates,
50 }) : _httpClient = HttpRequestImpl( 50 }) : _httpClient = HttpRequestImpl(
51 allowAutoSignedCert: allowAutoSignedCert, 51 allowAutoSignedCert: allowAutoSignedCert,
52 trustedCertificates: trustedCertificates, 52 trustedCertificates: trustedCertificates,
@@ -73,11 +73,11 @@ class GetHttpClient { @@ -73,11 +73,11 @@ class GetHttpClient {
73 _modifier.removeResponseModifier<T>(interceptor); 73 _modifier.removeResponseModifier<T>(interceptor);
74 } 74 }
75 75
76 - Uri _createUri(String url, Map<String, dynamic> query) { 76 + Uri _createUri(String? url, Map<String, dynamic>? query) {
77 if (baseUrl != null) { 77 if (baseUrl != null) {
78 - url = baseUrl + url; 78 + url = baseUrl! + url!;
79 } 79 }
80 - final uri = Uri.parse(url); 80 + final uri = Uri.parse(url!);
81 if (query != null) { 81 if (query != null) {
82 return uri.replace(queryParameters: query); 82 return uri.replace(queryParameters: query);
83 } 83 }
@@ -85,16 +85,16 @@ class GetHttpClient { @@ -85,16 +85,16 @@ class GetHttpClient {
85 } 85 }
86 86
87 Future<Request<T>> _requestWithBody<T>( 87 Future<Request<T>> _requestWithBody<T>(
88 - String url,  
89 - String contentType, 88 + String? url,
  89 + String? contentType,
90 dynamic body, 90 dynamic body,
91 String method, 91 String method,
92 - Map<String, dynamic> query,  
93 - Decoder<T> decoder,  
94 - Progress uploadProgress, 92 + Map<String, dynamic>? query,
  93 + Decoder<T>? decoder,
  94 + Progress? uploadProgress,
95 ) async { 95 ) async {
96 - List<int> bodyBytes;  
97 - BodyBytesStream bodyStream; 96 + List<int>? bodyBytes;
  97 + BodyBytesStream? bodyStream;
98 final headers = <String, String>{}; 98 final headers = <String, String>{};
99 99
100 headers['user-agent'] = userAgent; 100 headers['user-agent'] = userAgent;
@@ -139,7 +139,7 @@ class GetHttpClient { @@ -139,7 +139,7 @@ class GetHttpClient {
139 url: uri, 139 url: uri,
140 headers: headers, 140 headers: headers,
141 bodyBytes: bodyStream, 141 bodyBytes: bodyStream,
142 - contentLength: bodyBytes.length, 142 + contentLength: bodyBytes!.length,
143 followRedirects: followRedirects, 143 followRedirects: followRedirects,
144 maxRedirects: maxRedirects, 144 maxRedirects: maxRedirects,
145 decoder: decoder, 145 decoder: decoder,
@@ -148,7 +148,7 @@ class GetHttpClient { @@ -148,7 +148,7 @@ class GetHttpClient {
148 148
149 BodyBytesStream _trackProgress( 149 BodyBytesStream _trackProgress(
150 List<int> bodyBytes, 150 List<int> bodyBytes,
151 - Progress uploadProgress, 151 + Progress? uploadProgress,
152 ) { 152 ) {
153 var total = 0; 153 var total = 0;
154 var length = bodyBytes.length; 154 var length = bodyBytes.length;
@@ -169,7 +169,7 @@ class GetHttpClient { @@ -169,7 +169,7 @@ class GetHttpClient {
169 169
170 void _setSimpleHeaders( 170 void _setSimpleHeaders(
171 Map<String, String> headers, 171 Map<String, String> headers,
172 - String contentType, 172 + String? contentType,
173 ) { 173 ) {
174 headers['content-type'] = contentType ?? defaultContentType; 174 headers['content-type'] = contentType ?? defaultContentType;
175 headers['user-agent'] = userAgent; 175 headers['user-agent'] = userAgent;
@@ -179,7 +179,7 @@ class GetHttpClient { @@ -179,7 +179,7 @@ class GetHttpClient {
179 HandlerExecute<T> handler, { 179 HandlerExecute<T> handler, {
180 bool authenticate = false, 180 bool authenticate = false,
181 int requestNumber = 1, 181 int requestNumber = 1,
182 - Map<String, String> headers, 182 + Map<String, String>? headers,
183 }) async { 183 }) async {
184 try { 184 try {
185 var request = await handler(); 185 var request = await handler();
@@ -188,7 +188,7 @@ class GetHttpClient { @@ -188,7 +188,7 @@ class GetHttpClient {
188 request.headers[key] = value; 188 request.headers[key] = value;
189 }); 189 });
190 190
191 - if (authenticate) await _modifier.authenticator(request); 191 + if (authenticate) await _modifier.authenticator!(request);
192 await _modifier.modifyRequest(request); 192 await _modifier.modifyRequest(request);
193 193
194 var response = await _httpClient.send<T>(request); 194 var response = await _httpClient.send<T>(request);
@@ -238,9 +238,9 @@ class GetHttpClient { @@ -238,9 +238,9 @@ class GetHttpClient {
238 238
239 Future<Request<T>> _get<T>( 239 Future<Request<T>> _get<T>(
240 String url, 240 String url,
241 - String contentType,  
242 - Map<String, dynamic> query,  
243 - Decoder<T> decoder, 241 + String? contentType,
  242 + Map<String, dynamic>? query,
  243 + Decoder<T>? decoder,
244 ) { 244 ) {
245 final headers = <String, String>{}; 245 final headers = <String, String>{};
246 _setSimpleHeaders(headers, contentType); 246 _setSimpleHeaders(headers, contentType);
@@ -250,18 +250,18 @@ class GetHttpClient { @@ -250,18 +250,18 @@ class GetHttpClient {
250 method: 'get', 250 method: 'get',
251 url: uri, 251 url: uri,
252 headers: headers, 252 headers: headers,
253 - decoder: decoder ?? (defaultDecoder as Decoder<T>), 253 + decoder: decoder ?? (defaultDecoder as Decoder<T>?),
254 )); 254 ));
255 } 255 }
256 256
257 Future<Request<T>> _request<T>( 257 Future<Request<T>> _request<T>(
258 - String url, 258 + String? url,
259 String method, { 259 String method, {
260 - String contentType,  
261 - @required dynamic body,  
262 - @required Map<String, dynamic> query,  
263 - Decoder<T> decoder,  
264 - @required Progress uploadProgress, 260 + String? contentType,
  261 + required dynamic body,
  262 + required Map<String, dynamic>? query,
  263 + Decoder<T>? decoder,
  264 + required Progress? uploadProgress,
265 }) { 265 }) {
266 return _requestWithBody<T>( 266 return _requestWithBody<T>(
267 url, 267 url,
@@ -269,16 +269,16 @@ class GetHttpClient { @@ -269,16 +269,16 @@ class GetHttpClient {
269 body, 269 body,
270 method, 270 method,
271 query, 271 query,
272 - decoder ?? (defaultDecoder as Decoder<T>), 272 + decoder ?? (defaultDecoder as Decoder<T>?),
273 uploadProgress, 273 uploadProgress,
274 ); 274 );
275 } 275 }
276 276
277 Request<T> _delete<T>( 277 Request<T> _delete<T>(
278 String url, 278 String url,
279 - String contentType,  
280 - Map<String, dynamic> query,  
281 - Decoder<T> decoder, 279 + String? contentType,
  280 + Map<String, dynamic>? query,
  281 + Decoder<T>? decoder,
282 ) { 282 ) {
283 final headers = <String, String>{}; 283 final headers = <String, String>{};
284 _setSimpleHeaders(headers, contentType); 284 _setSimpleHeaders(headers, contentType);
@@ -288,18 +288,18 @@ class GetHttpClient { @@ -288,18 +288,18 @@ class GetHttpClient {
288 method: 'delete', 288 method: 'delete',
289 url: uri, 289 url: uri,
290 headers: headers, 290 headers: headers,
291 - decoder: decoder ?? (defaultDecoder as Decoder<T>), 291 + decoder: decoder ?? (defaultDecoder as Decoder<T>?),
292 ); 292 );
293 } 293 }
294 294
295 Future<Response<T>> patch<T>( 295 Future<Response<T>> patch<T>(
296 String url, { 296 String url, {
297 dynamic body, 297 dynamic body,
298 - String contentType,  
299 - Map<String, String> headers,  
300 - Map<String, dynamic> query,  
301 - Decoder<T> decoder,  
302 - Progress uploadProgress, 298 + String? contentType,
  299 + Map<String, String>? headers,
  300 + Map<String, dynamic>? query,
  301 + Decoder<T>? decoder,
  302 + Progress? uploadProgress,
303 // List<MultipartFile> files, 303 // List<MultipartFile> files,
304 }) async { 304 }) async {
305 try { 305 try {
@@ -327,13 +327,13 @@ class GetHttpClient { @@ -327,13 +327,13 @@ class GetHttpClient {
327 } 327 }
328 328
329 Future<Response<T>> post<T>( 329 Future<Response<T>> post<T>(
330 - String url, { 330 + String? url, {
331 dynamic body, 331 dynamic body,
332 - String contentType,  
333 - Map<String, String> headers,  
334 - Map<String, dynamic> query,  
335 - Decoder<T> decoder,  
336 - Progress uploadProgress, 332 + String? contentType,
  333 + Map<String, String>? headers,
  334 + Map<String, dynamic>? query,
  335 + Decoder<T>? decoder,
  336 + Progress? uploadProgress,
337 // List<MultipartFile> files, 337 // List<MultipartFile> files,
338 }) async { 338 }) async {
339 try { 339 try {
@@ -364,11 +364,11 @@ class GetHttpClient { @@ -364,11 +364,11 @@ class GetHttpClient {
364 String url, 364 String url,
365 String method, { 365 String method, {
366 dynamic body, 366 dynamic body,
367 - String contentType,  
368 - Map<String, String> headers,  
369 - Map<String, dynamic> query,  
370 - Decoder<T> decoder,  
371 - Progress uploadProgress, 367 + String? contentType,
  368 + Map<String, String>? headers,
  369 + Map<String, dynamic>? query,
  370 + Decoder<T>? decoder,
  371 + Progress? uploadProgress,
372 }) async { 372 }) async {
373 try { 373 try {
374 var response = await _performRequest<T>( 374 var response = await _performRequest<T>(
@@ -397,11 +397,11 @@ class GetHttpClient { @@ -397,11 +397,11 @@ class GetHttpClient {
397 Future<Response<T>> put<T>( 397 Future<Response<T>> put<T>(
398 String url, { 398 String url, {
399 dynamic body, 399 dynamic body,
400 - String contentType,  
401 - Map<String, String> headers,  
402 - Map<String, dynamic> query,  
403 - Decoder<T> decoder,  
404 - Progress uploadProgress, 400 + String? contentType,
  401 + Map<String, String>? headers,
  402 + Map<String, dynamic>? query,
  403 + Decoder<T>? decoder,
  404 + Progress? uploadProgress,
405 }) async { 405 }) async {
406 try { 406 try {
407 var response = await _performRequest<T>( 407 var response = await _performRequest<T>(
@@ -429,10 +429,10 @@ class GetHttpClient { @@ -429,10 +429,10 @@ class GetHttpClient {
429 429
430 Future<Response<T>> get<T>( 430 Future<Response<T>> get<T>(
431 String url, { 431 String url, {
432 - Map<String, String> headers,  
433 - String contentType,  
434 - Map<String, dynamic> query,  
435 - Decoder<T> decoder, 432 + Map<String, String>? headers,
  433 + String? contentType,
  434 + Map<String, dynamic>? query,
  435 + Decoder<T>? decoder,
436 }) async { 436 }) async {
437 try { 437 try {
438 var response = await _performRequest<T>( 438 var response = await _performRequest<T>(
@@ -513,10 +513,10 @@ class GetHttpClient { @@ -513,10 +513,10 @@ class GetHttpClient {
513 513
514 Future<Response<T>> delete<T>( 514 Future<Response<T>> delete<T>(
515 String url, { 515 String url, {
516 - Map<String, String> headers,  
517 - String contentType,  
518 - Map<String, dynamic> query,  
519 - Decoder<T> decoder, 516 + Map<String, String>? headers,
  517 + String? contentType,
  518 + Map<String, dynamic>? query,
  519 + Decoder<T>? decoder,
520 }) async { 520 }) async {
521 try { 521 try {
522 var response = await _performRequest<T>( 522 var response = await _performRequest<T>(
@@ -13,7 +13,7 @@ import '../utils/body_decoder.dart'; @@ -13,7 +13,7 @@ import '../utils/body_decoder.dart';
13 class HttpRequestImpl implements HttpRequestBase { 13 class HttpRequestImpl implements HttpRequestBase {
14 HttpRequestImpl({ 14 HttpRequestImpl({
15 bool allowAutoSignedCert = true, 15 bool allowAutoSignedCert = true,
16 - List<TrustedCertificate> trustedCertificates, 16 + List<TrustedCertificate>? trustedCertificates,
17 }); 17 });
18 18
19 /// The currently active XHRs. 19 /// The currently active XHRs.
@@ -41,16 +41,16 @@ class HttpRequestImpl implements HttpRequestBase { @@ -41,16 +41,16 @@ class HttpRequestImpl implements HttpRequestBase {
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 Uint8List?);
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,33 +10,33 @@ import '../utils/body_decoder.dart'; @@ -10,33 +10,33 @@ 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
34 Future<Response<T>> send<T>(Request<T> request) async { 34 Future<Response<T>> send<T>(Request<T> request) async {
35 - var stream = request.bodyBytes.asBroadcastStream(); 35 + Stream<List<int>?> stream = request.bodyBytes.asBroadcastStream();
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
@@ -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 }
@@ -20,10 +20,10 @@ class MockClient extends HttpRequestBase { @@ -20,10 +20,10 @@ class MockClient extends HttpRequestBase {
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);
@@ -83,7 +83,7 @@ class FormData { @@ -83,7 +83,7 @@ class FormData {
83 _maxBoundaryLength + 83 _maxBoundaryLength +
84 '\r\n'.length + 84 '\r\n'.length +
85 utf8.encode(_fileHeader(file)).length + 85 utf8.encode(_fileHeader(file)).length +
86 - file.value.length + 86 + file.value.length! +
87 '\r\n'.length; 87 '\r\n'.length;
88 } 88 }
89 89
@@ -109,7 +109,7 @@ class FormData { @@ -109,7 +109,7 @@ class FormData {
109 for (final file in files) { 109 for (final file in files) {
110 yield separator; 110 yield separator;
111 yield utf8.encode(_fileHeader(file)); 111 yield utf8.encode(_fileHeader(file));
112 - yield* file.value.stream; 112 + yield* file.value.stream! as Stream<List<int>>;
113 yield line; 113 yield line;
114 } 114 }
115 yield close; 115 yield close;
@@ -9,7 +9,7 @@ import '../request/request.dart'; @@ -9,7 +9,7 @@ import '../request/request.dart';
9 class MultipartFile { 9 class MultipartFile {
10 MultipartFile( 10 MultipartFile(
11 dynamic data, { 11 dynamic data, {
12 - @required this.filename, 12 + required this.filename,
13 this.contentType = 'application/octet-stream', 13 this.contentType = 'application/octet-stream',
14 }) : _bytes = fileToBytes(data) { 14 }) : _bytes = fileToBytes(data) {
15 _length = _bytes.length; 15 _length = _bytes.length;
@@ -21,13 +21,13 @@ class MultipartFile { @@ -21,13 +21,13 @@ class MultipartFile {
21 final String contentType; 21 final String contentType;
22 22
23 /// This stream will emit the file content of File. 23 /// This stream will emit the file content of File.
24 - BodyBytesStream _stream; 24 + BodyBytesStream? _stream;
25 25
26 - int _length; 26 + int? _length;
27 27
28 - BodyBytesStream get stream => _stream; 28 + BodyBytesStream? get stream => _stream;
29 29
30 - int get length => _length; 30 + int? get length => _length;
31 31
32 final String filename; 32 final String filename;
33 } 33 }
@@ -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,13 +12,13 @@ class Request<T> { @@ -14,13 +12,13 @@ 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 BodyBytesStream bodyBytes;
@@ -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 + BodyBytesStream? 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,10 +76,10 @@ class Request<T> { @@ -82,10 +76,10 @@ class Request<T> {
82 } 76 }
83 } 77 }
84 78
85 -class BodyBytesStream extends StreamView<List<int>> {  
86 - BodyBytesStream(Stream<List<int>> stream) : super(stream); 79 +class BodyBytesStream extends StreamView<List<int>?> {
  80 + BodyBytesStream(Stream<List<int>?> stream) : super(stream);
87 81
88 - factory BodyBytesStream.fromBytes(List<int> bytes) => 82 + factory BodyBytesStream.fromBytes(List<int>? bytes) =>
89 BodyBytesStream(Stream.fromIterable([bytes])); 83 BodyBytesStream(Stream.fromIterable([bytes]));
90 84
91 Future<Uint8List> toBytes() { 85 Future<Uint8List> toBytes() {
@@ -95,7 +89,7 @@ class BodyBytesStream extends StreamView<List<int>> { @@ -95,7 +89,7 @@ class BodyBytesStream extends StreamView<List<int>> {
95 Uint8List.fromList(bytes), 89 Uint8List.fromList(bytes),
96 ), 90 ),
97 ); 91 );
98 - listen(sink.add, 92 + listen((val) => sink.add(val!),
99 onError: completer.completeError, 93 onError: completer.completeError,
100 onDone: sink.close, 94 onDone: sink.close,
101 cancelOnError: true); 95 cancelOnError: true);
@@ -103,5 +97,5 @@ class BodyBytesStream extends StreamView<List<int>> { @@ -103,5 +97,5 @@ class BodyBytesStream extends StreamView<List<int>> {
103 } 97 }
104 98
105 Future<String> bytesToString([Encoding encoding = utf8]) => 99 Future<String> bytesToString([Encoding encoding = utf8]) =>
106 - encoding.decodeStream(this); 100 + encoding.decodeStream(this as Stream<List<int>>);
107 } 101 }
@@ -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,15 +49,15 @@ class Response<T> { @@ -49,15 +49,15 @@ 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 BodyBytesStream? 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(
@@ -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);
@@ -53,7 +53,7 @@ String validateField(String field) { @@ -53,7 +53,7 @@ String validateField(String field) {
53 } 53 }
54 54
55 BodyBytesStream toBodyBytesStream(Stream<List<int>> stream) { 55 BodyBytesStream toBodyBytesStream(Stream<List<int>> stream) {
56 - if (stream is BodyBytesStream) return stream; 56 + if (stream is BodyBytesStream) return stream as BodyBytesStream;
57 return BodyBytesStream(stream); 57 return BodyBytesStream(stream);
58 } 58 }
59 59
@@ -3,7 +3,7 @@ import 'src/sockets_stub.dart' @@ -3,7 +3,7 @@ import 'src/sockets_stub.dart'
3 if (dart.library.io) 'src/sockets_io.dart'; 3 if (dart.library.io) 'src/sockets_io.dart';
4 4
5 class GetSocket extends BaseWebSocket { 5 class GetSocket extends BaseWebSocket {
6 - GetSocket(String url, 6 + GetSocket(String? url,
7 {Duration ping = const Duration(seconds: 5), bool allowSelfSigned = true}) 7 {Duration ping = const Duration(seconds: 5), bool allowSelfSigned = true})
8 : super(url, ping: ping, allowSelfSigned: allowSelfSigned); 8 : super(url, ping: ping, allowSelfSigned: allowSelfSigned);
9 } 9 }
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,51 @@ class BaseWebSocket { @@ -38,51 +38,51 @@ 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!.notifyError(Close(e.osError!.message, e.osError!.errorCode));
58 return; 58 return;
59 } 59 }
60 } 60 }
61 61
62 // ignore: use_setters_to_change_properties 62 // ignore: use_setters_to_change_properties
63 void onOpen(OpenSocket fn) { 63 void onOpen(OpenSocket fn) {
64 - socketNotifier.open = fn; 64 + socketNotifier!.open = fn;
65 } 65 }
66 66
67 void onClose(CloseSocket fn) { 67 void onClose(CloseSocket fn) {
68 - socketNotifier.addCloses(fn); 68 + socketNotifier!.addCloses(fn);
69 } 69 }
70 70
71 void onError(CloseSocket fn) { 71 void onError(CloseSocket fn) {
72 - socketNotifier.addErrors(fn); 72 + socketNotifier!.addErrors(fn);
73 } 73 }
74 74
75 void onMessage(MessageSocket fn) { 75 void onMessage(MessageSocket fn) {
76 - socketNotifier.addMessages(fn); 76 + socketNotifier!.addMessages(fn);
77 } 77 }
78 78
79 void on(String event, MessageSocket message) { 79 void on(String event, MessageSocket message) {
80 - socketNotifier.addEvents(event, message); 80 + socketNotifier!.addEvents(event, message);
81 } 81 }
82 82
83 - void close([int status, String reason]) { 83 + void close([int? status, String? reason]) {
84 if (socket != null) { 84 if (socket != null) {
85 - socket.close(status, reason); 85 + socket!.close(status, reason);
86 } 86 }
87 } 87 }
88 88
@@ -92,12 +92,12 @@ class BaseWebSocket { @@ -92,12 +92,12 @@ class BaseWebSocket {
92 } 92 }
93 93
94 if (socket != null) { 94 if (socket != null) {
95 - socket.add(data); 95 + socket!.add(data);
96 } 96 }
97 } 97 }
98 98
99 void dispose() { 99 void dispose() {
100 - socketNotifier.dispose(); 100 + socketNotifier!.dispose();
101 socketNotifier = null; 101 socketNotifier = null;
102 isDisposed = true; 102 isDisposed = true;
103 } 103 }
1 import './socket_notifier.dart'; 1 import './socket_notifier.dart';
2 2
3 class BaseWebSocket { 3 class BaseWebSocket {
4 - String url; 4 + String? url;
5 Duration ping; 5 Duration ping;
6 bool allowSelfSigned; 6 bool allowSelfSigned;
7 BaseWebSocket( 7 BaseWebSocket(
@@ -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 }
@@ -2,9 +2,9 @@ import 'dart:developer' as developer; @@ -2,9 +2,9 @@ import 'dart:developer' as developer;
2 import 'get_main.dart'; 2 import 'get_main.dart';
3 3
4 ///Voidcallback from logs 4 ///Voidcallback from logs
5 -typedef LogWriterCallback = void Function(String text, {bool isError}); 5 +typedef LogWriterCallback = void Function(String text, {bool? isError});
6 6
7 /// default logger from GetX 7 /// default logger from GetX
8 -void defaultLogWriterCallback(String value, {bool isError = false}) {  
9 - if (isError || Get.isLogEnable) developer.log(value, name: 'GETX'); 8 +void defaultLogWriterCallback(String value, {bool? isError = false}) {
  9 + if (isError! || Get.isLogEnable) developer.log(value, name: 'GETX');
10 } 10 }
@@ -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
@@ -39,8 +39,8 @@ extension Inst on GetInterface { @@ -39,8 +39,8 @@ extension Inst on GetInterface {
39 /// async version of [Get.put()]. 39 /// async version of [Get.put()].
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,  
43 - {String tag, bool permanent = false}) async => 42 + Future<S?> putAsync<S>(AsyncInstanceBuilderCallback<S> builder,
  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 ///
@@ -83,10 +83,10 @@ extension Inst on GetInterface { @@ -83,10 +83,10 @@ extension Inst on GetInterface {
83 /// rules. Although, can be removed by [GetInstance.reset()] 83 /// rules. Although, can be removed by [GetInstance.reset()]
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,  
87 - {String tag, 86 + S? put<S>(S dependency,
  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,15 @@ extension Inst on GetInterface { @@ -104,15 +104,15 @@ 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}) => GetInstance().isRegistered<S>(tag: tag);
113 113
114 /// Checks if an Instance<[S]> (or [tag]) returned from a factory builder 114 /// Checks if an Instance<[S]> (or [tag]) returned from a factory builder
115 /// [Get.lazyPut()], is registered in memory. 115 /// [Get.lazyPut()], is registered in memory.
116 /// - [tag] optional, if you use a [tag] to register the Instance. 116 /// - [tag] optional, if you use a [tag] to register the Instance.
117 - bool isPrepared<S>({String tag}) => GetInstance().isPrepared<S>(tag: tag); 117 + bool isPrepared<S>({String? tag}) => GetInstance().isPrepared<S>(tag: tag);
118 } 118 }
@@ -8,18 +8,18 @@ import '../../get_core/get_core.dart'; @@ -8,18 +8,18 @@ import '../../get_core/get_core.dart';
8 import 'lifecycle.dart'; 8 import 'lifecycle.dart';
9 9
10 class InstanceInfo { 10 class InstanceInfo {
11 - final bool isPermanent;  
12 - final bool isSingleton;  
13 - bool get isCreate => !isSingleton; 11 + final bool? isPermanent;
  12 + final bool? isSingleton;
  13 + bool get isCreate => !isSingleton!;
14 final bool isRegistered; 14 final bool isRegistered;
15 final bool isPrepared; 15 final bool isPrepared;
16 - final bool isInit; 16 + final bool? isInit;
17 const InstanceInfo({ 17 const InstanceInfo({
18 - @required this.isPermanent,  
19 - @required this.isSingleton,  
20 - @required this.isRegistered,  
21 - @required this.isPrepared,  
22 - @required this.isInit, 18 + required this.isPermanent,
  19 + required this.isSingleton,
  20 + required this.isRegistered,
  21 + required this.isPrepared,
  22 + required this.isInit,
23 }); 23 });
24 } 24 }
25 25
@@ -28,9 +28,9 @@ class GetInstance { @@ -28,9 +28,9 @@ class GetInstance {
28 28
29 const GetInstance._(); 29 const GetInstance._();
30 30
31 - static GetInstance _getInstance; 31 + static GetInstance? _getInstance;
32 32
33 - T call<T>() => find<T>(); 33 + T? call<T>() => find<T>();
34 34
35 /// Holds references to every registered Instance when using 35 /// Holds references to every registered Instance when using
36 /// [Get.put()] 36 /// [Get.put()]
@@ -42,13 +42,13 @@ class GetInstance { @@ -42,13 +42,13 @@ class GetInstance {
42 42
43 /// Holds a reference to [Get.reference] when the Instance was 43 /// Holds a reference to [Get.reference] when the Instance was
44 /// created to manage the memory. 44 /// created to manage the memory.
45 - static final Map<String, String> _routesKey = {}; 45 + static final Map<String, String?> _routesKey = {};
46 46
47 /// Stores the onClose() references of instances created with [Get.create()] 47 /// Stores the onClose() references of instances created with [Get.create()]
48 /// using the [Get.reference]. 48 /// using the [Get.reference].
49 /// Experimental feature to keep the lifecycle and memory management with 49 /// Experimental feature to keep the lifecycle and memory management with
50 /// non-singleton instances. 50 /// non-singleton instances.
51 - static final Map<String, HashSet<Function>> _routesByCreate = {}; 51 + static final Map<String?, HashSet<Function>> _routesByCreate = {};
52 52
53 void printInstanceStack() { 53 void printInstanceStack() {
54 Get.log(_routesKey.toString()); 54 Get.log(_routesKey.toString());
@@ -56,7 +56,7 @@ class GetInstance { @@ -56,7 +56,7 @@ class GetInstance {
56 56
57 void injector<S>( 57 void injector<S>(
58 InjectorBuilderCallback<S> fn, { 58 InjectorBuilderCallback<S> fn, {
59 - String tag, 59 + String? tag,
60 bool fenix = false, 60 bool fenix = false,
61 // bool permanent = false, 61 // bool permanent = false,
62 }) { 62 }) {
@@ -71,9 +71,9 @@ class GetInstance { @@ -71,9 +71,9 @@ class GetInstance {
71 /// async version of [Get.put()]. 71 /// async version of [Get.put()].
72 /// Awaits for the resolution of the Future from [builder()] parameter and 72 /// Awaits for the resolution of the Future from [builder()] parameter and
73 /// stores the Instance returned. 73 /// stores the Instance returned.
74 - Future<S> putAsync<S>( 74 + Future<S?> putAsync<S>(
75 AsyncInstanceBuilderCallback<S> builder, { 75 AsyncInstanceBuilderCallback<S> builder, {
76 - String tag, 76 + String? tag,
77 bool permanent = false, 77 bool permanent = false,
78 }) async { 78 }) async {
79 return put<S>(await builder(), tag: tag, permanent: permanent); 79 return put<S>(await builder(), tag: tag, permanent: permanent);
@@ -89,11 +89,11 @@ class GetInstance { @@ -89,11 +89,11 @@ class GetInstance {
89 /// the same Type<[S]> 89 /// the same Type<[S]>
90 /// - [permanent] keeps the Instance in memory, not following 90 /// - [permanent] keeps the Instance in memory, not following
91 /// [Get.smartManagement] rules. 91 /// [Get.smartManagement] rules.
92 - S put<S>( 92 + S? put<S>(
93 S dependency, { 93 S dependency, {
94 - String tag, 94 + String? tag,
95 bool permanent = false, 95 bool permanent = false,
96 - @deprecated InstanceBuilderCallback<S> builder, 96 + @deprecated InstanceBuilderCallback<S>? builder,
97 }) { 97 }) {
98 _insert( 98 _insert(
99 isSingleton: true, 99 isSingleton: true,
@@ -127,8 +127,8 @@ class GetInstance { @@ -127,8 +127,8 @@ class GetInstance {
127 /// (<[S]> and optionally [tag] will **not** override the original). 127 /// (<[S]> and optionally [tag] will **not** override the original).
128 void lazyPut<S>( 128 void lazyPut<S>(
129 InstanceBuilderCallback<S> builder, { 129 InstanceBuilderCallback<S> builder, {
130 - String tag,  
131 - bool fenix, 130 + String? tag,
  131 + bool? fenix,
132 bool permanent = false, 132 bool permanent = false,
133 }) { 133 }) {
134 _insert( 134 _insert(
@@ -158,7 +158,7 @@ class GetInstance { @@ -158,7 +158,7 @@ class GetInstance {
158 /// print(a==b); (false)``` 158 /// print(a==b); (false)```
159 void create<S>( 159 void create<S>(
160 InstanceBuilderCallback<S> builder, { 160 InstanceBuilderCallback<S> builder, {
161 - String tag, 161 + String? tag,
162 bool permanent = true, 162 bool permanent = true,
163 }) { 163 }) {
164 _insert( 164 _insert(
@@ -171,10 +171,10 @@ class GetInstance { @@ -171,10 +171,10 @@ class GetInstance {
171 171
172 /// Injects the Instance [S] builder into the [_singleton] HashMap. 172 /// Injects the Instance [S] builder into the [_singleton] HashMap.
173 void _insert<S>({ 173 void _insert<S>({
174 - bool isSingleton,  
175 - String name, 174 + bool? isSingleton,
  175 + String? name,
176 bool permanent = false, 176 bool permanent = false,
177 - InstanceBuilderCallback<S> builder, 177 + required InstanceBuilderCallback<S> builder,
178 bool fenix = false, 178 bool fenix = false,
179 }) { 179 }) {
180 assert(builder != null); 180 assert(builder != null);
@@ -206,14 +206,14 @@ class GetInstance { @@ -206,14 +206,14 @@ class GetInstance {
206 206
207 /// Removes [Get.create()] instances registered in [routeName]. 207 /// Removes [Get.create()] instances registered in [routeName].
208 if (_routesByCreate.containsKey(routeName)) { 208 if (_routesByCreate.containsKey(routeName)) {
209 - for (final onClose in _routesByCreate[routeName]) { 209 + for (final onClose in _routesByCreate[routeName]!) {
210 // assure the [DisposableInterface] instance holding a reference 210 // assure the [DisposableInterface] instance holding a reference
211 // to [onClose()] wasn't disposed. 211 // to [onClose()] wasn't disposed.
212 if (onClose != null) { 212 if (onClose != null) {
213 onClose(); 213 onClose();
214 } 214 }
215 } 215 }
216 - _routesByCreate[routeName].clear(); 216 + _routesByCreate[routeName]!.clear();
217 _routesByCreate.remove(routeName); 217 _routesByCreate.remove(routeName);
218 } 218 }
219 219
@@ -236,14 +236,14 @@ class GetInstance { @@ -236,14 +236,14 @@ class GetInstance {
236 /// (not for Singletons access). 236 /// (not for Singletons access).
237 /// Returns the instance if not initialized, required for Get.create() to 237 /// Returns the instance if not initialized, required for Get.create() to
238 /// work properly. 238 /// work properly.
239 - S _initDependencies<S>({String name}) { 239 + S? _initDependencies<S>({String? name}) {
240 final key = _getKey(S, name); 240 final key = _getKey(S, name);
241 - final isInit = _singl[key].isInit;  
242 - S i; 241 + final isInit = _singl[key]!.isInit;
  242 + S? i;
243 if (!isInit) { 243 if (!isInit) {
244 i = _startController<S>(tag: name); 244 i = _startController<S>(tag: name);
245 - if (_singl[key].isSingleton) {  
246 - _singl[key].isInit = true; 245 + if (_singl[key]!.isSingleton!) {
  246 + _singl[key]!.isInit = true;
247 if (Get.smartManagement != SmartManagement.onlyBuilder) { 247 if (Get.smartManagement != SmartManagement.onlyBuilder) {
248 _registerRouteInstance<S>(tag: name); 248 _registerRouteInstance<S>(tag: name);
249 } 249 }
@@ -254,11 +254,11 @@ class GetInstance { @@ -254,11 +254,11 @@ class GetInstance {
254 254
255 /// Links a Class instance [S] (or [tag]) to the current route. 255 /// Links a Class instance [S] (or [tag]) to the current route.
256 /// Requires usage of [GetMaterialApp]. 256 /// Requires usage of [GetMaterialApp].
257 - void _registerRouteInstance<S>({String tag}) { 257 + void _registerRouteInstance<S>({String? tag}) {
258 _routesKey.putIfAbsent(_getKey(S, tag), () => Get.reference); 258 _routesKey.putIfAbsent(_getKey(S, tag), () => Get.reference);
259 } 259 }
260 260
261 - InstanceInfo getInstanceInfo<S>({String tag}) { 261 + InstanceInfo getInstanceInfo<S>({String? tag}) {
262 final build = _getDependency<S>(tag: tag); 262 final build = _getDependency<S>(tag: tag);
263 263
264 return InstanceInfo( 264 return InstanceInfo(
@@ -270,7 +270,7 @@ class GetInstance { @@ -270,7 +270,7 @@ class GetInstance {
270 ); 270 );
271 } 271 }
272 272
273 - _InstanceBuilderFactory _getDependency<S>({String tag, String key}) { 273 + _InstanceBuilderFactory? _getDependency<S>({String? tag, String? key}) {
274 final newKey = key ?? _getKey(S, tag); 274 final newKey = key ?? _getKey(S, tag);
275 275
276 if (!_singl.containsKey(newKey)) { 276 if (!_singl.containsKey(newKey)) {
@@ -282,9 +282,9 @@ class GetInstance { @@ -282,9 +282,9 @@ class GetInstance {
282 } 282 }
283 283
284 /// Initializes the controller 284 /// Initializes the controller
285 - S _startController<S>({String tag}) { 285 + S? _startController<S>({String? tag}) {
286 final key = _getKey(S, tag); 286 final key = _getKey(S, tag);
287 - final i = _singl[key].getDependency() as S; 287 + final i = _singl[key]!.getDependency() as S?;
288 if (i is GetLifeCycleBase) { 288 if (i is GetLifeCycleBase) {
289 if (i.onStart != null) { 289 if (i.onStart != null) {
290 i.onStart(); 290 i.onStart();
@@ -294,19 +294,19 @@ class GetInstance { @@ -294,19 +294,19 @@ class GetInstance {
294 Get.log('Instance "$S" with tag "$tag" has been initialized'); 294 Get.log('Instance "$S" with tag "$tag" has been initialized');
295 } 295 }
296 } 296 }
297 - if (!_singl[key].isSingleton && i.onDelete != null) { 297 + if (!_singl[key]!.isSingleton! && i.onDelete != null) {
298 _routesByCreate[Get.reference] ??= HashSet<Function>(); 298 _routesByCreate[Get.reference] ??= HashSet<Function>();
299 - _routesByCreate[Get.reference].add(i.onDelete); 299 + _routesByCreate[Get.reference]!.add(i.onDelete as Function);
300 } 300 }
301 } 301 }
302 return i; 302 return i;
303 } 303 }
304 304
305 - S putOrFind<S>(InstanceBuilderCallback<S> dep, {String tag}) { 305 + S? putOrFind<S>(InstanceBuilderCallback<S> dep, {String? tag}) {
306 final key = _getKey(S, tag); 306 final key = _getKey(S, tag);
307 307
308 if (_singl.containsKey(key)) { 308 if (_singl.containsKey(key)) {
309 - return _singl[key].getDependency() as S; 309 + return _singl[key]!.getDependency() as S?;
310 } else { 310 } else {
311 return GetInstance().put(dep(), tag: tag); 311 return GetInstance().put(dep(), tag: tag);
312 } 312 }
@@ -317,7 +317,7 @@ class GetInstance { @@ -317,7 +317,7 @@ class GetInstance {
317 /// it will create an instance each time you call [find]. 317 /// it will create an instance each time you call [find].
318 /// If the registered type <[S]> (or [tag]) is a Controller, 318 /// If the registered type <[S]> (or [tag]) is a Controller,
319 /// it will initialize it's lifecycle. 319 /// it will initialize it's lifecycle.
320 - S find<S>({String tag}) { 320 + S? find<S>({String? tag}) {
321 final key = _getKey(S, tag); 321 final key = _getKey(S, tag);
322 if (isRegistered<S>(tag: tag)) { 322 if (isRegistered<S>(tag: tag)) {
323 if (_singl[key] == null) { 323 if (_singl[key] == null) {
@@ -332,7 +332,7 @@ class GetInstance { @@ -332,7 +332,7 @@ class GetInstance {
332 /// `initDependencies`, so we have to return the instance from there 332 /// `initDependencies`, so we have to return the instance from there
333 /// to make it compatible with `Get.create()`. 333 /// to make it compatible with `Get.create()`.
334 final i = _initDependencies<S>(name: tag); 334 final i = _initDependencies<S>(name: tag);
335 - return i ?? _singl[key].getDependency() as S; 335 + return i ?? _singl[key]!.getDependency() as S?;
336 } else { 336 } else {
337 // ignore: lines_longer_than_80_chars 337 // ignore: lines_longer_than_80_chars
338 throw '"$S" not found. You need to call "Get.put($S())" or "Get.lazyPut(()=>$S())"'; 338 throw '"$S" not found. You need to call "Get.put($S())" or "Get.lazyPut(()=>$S())"';
@@ -341,7 +341,7 @@ class GetInstance { @@ -341,7 +341,7 @@ class GetInstance {
341 341
342 /// Generates the key based on [type] (and optionally a [name]) 342 /// Generates the key based on [type] (and optionally a [name])
343 /// to register an Instance Builder in the hashmap. 343 /// to register an Instance Builder in the hashmap.
344 - String _getKey(Type type, String name) { 344 + String _getKey(Type type, String? name) {
345 return name == null ? type.toString() : type.toString() + name; 345 return name == null ? type.toString() : type.toString() + name;
346 } 346 }
347 347
@@ -374,7 +374,7 @@ class GetInstance { @@ -374,7 +374,7 @@ class GetInstance {
374 /// - [key] For internal usage, is the processed key used to register 374 /// - [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. 375 /// the Instance. **don't use** it unless you know what you are doing.
376 /// - [force] Will delete an Instance even if marked as [permanent]. 376 /// - [force] Will delete an Instance even if marked as [permanent].
377 - bool delete<S>({String tag, String key, bool force = false}) { 377 + bool delete<S>({String? tag, String? key, bool force = false}) {
378 final newKey = key ?? _getKey(S, tag); 378 final newKey = key ?? _getKey(S, tag);
379 379
380 if (!_singl.containsKey(newKey)) { 380 if (!_singl.containsKey(newKey)) {
@@ -382,7 +382,7 @@ class GetInstance { @@ -382,7 +382,7 @@ class GetInstance {
382 return false; 382 return false;
383 } 383 }
384 384
385 - final builder = _singl[newKey]; 385 + final builder = _singl[newKey]!;
386 386
387 if (builder.permanent && !force) { 387 if (builder.permanent && !force) {
388 Get.log( 388 Get.log(
@@ -430,7 +430,7 @@ class GetInstance { @@ -430,7 +430,7 @@ class GetInstance {
430 }); 430 });
431 } 431 }
432 432
433 - void reload<S>({String tag, String key, bool force = false}) { 433 + void reload<S>({String? tag, String? key, bool force = false}) {
434 final newKey = key ?? _getKey(S, tag); 434 final newKey = key ?? _getKey(S, tag);
435 435
436 final builder = _getDependency<S>(tag: tag, key: newKey); 436 final builder = _getDependency<S>(tag: tag, key: newKey);
@@ -451,12 +451,12 @@ class GetInstance { @@ -451,12 +451,12 @@ class GetInstance {
451 451
452 /// Check if a Class Instance<[S]> (or [tag]) is registered in memory. 452 /// 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. 453 /// - [tag] is optional, if you used a [tag] to register the Instance.
454 - bool isRegistered<S>({String tag}) => _singl.containsKey(_getKey(S, tag)); 454 + bool isRegistered<S>({String? tag}) => _singl.containsKey(_getKey(S, tag));
455 455
456 /// Checks if a lazy factory callback ([Get.lazyPut()] that returns an 456 /// Checks if a lazy factory callback ([Get.lazyPut()] that returns an
457 /// Instance<[S]> is registered in memory. 457 /// Instance<[S]> is registered in memory.
458 /// - [tag] is optional, if you used a [tag] to register the lazy Instance. 458 /// - [tag] is optional, if you used a [tag] to register the lazy Instance.
459 - bool isPrepared<S>({String tag}) { 459 + bool isPrepared<S>({String? tag}) {
460 final newKey = _getKey(S, tag); 460 final newKey = _getKey(S, tag);
461 461
462 final builder = _getDependency<S>(tag: tag, key: newKey); 462 final builder = _getDependency<S>(tag: tag, key: newKey);
@@ -481,14 +481,14 @@ typedef AsyncInstanceBuilderCallback<S> = Future<S> Function(); @@ -481,14 +481,14 @@ typedef AsyncInstanceBuilderCallback<S> = Future<S> Function();
481 class _InstanceBuilderFactory<S> { 481 class _InstanceBuilderFactory<S> {
482 /// Marks the Builder as a single instance. 482 /// Marks the Builder as a single instance.
483 /// For reusing [dependency] instead of [builderFunc] 483 /// For reusing [dependency] instead of [builderFunc]
484 - bool isSingleton; 484 + bool? isSingleton;
485 485
486 /// When fenix mode is avaliable, when a new instance is need 486 /// When fenix mode is avaliable, when a new instance is need
487 /// Instance manager will recreate a new instance of S 487 /// Instance manager will recreate a new instance of S
488 bool fenix; 488 bool fenix;
489 489
490 /// Stores the actual object instance when [isSingleton]=true. 490 /// Stores the actual object instance when [isSingleton]=true.
491 - S dependency; 491 + S? dependency;
492 492
493 /// Generates (and regenerates) the instance when [isSingleton]=false. 493 /// Generates (and regenerates) the instance when [isSingleton]=false.
494 /// Usually used by factory methods 494 /// Usually used by factory methods
@@ -500,7 +500,7 @@ class _InstanceBuilderFactory<S> { @@ -500,7 +500,7 @@ class _InstanceBuilderFactory<S> {
500 500
501 bool isInit = false; 501 bool isInit = false;
502 502
503 - String tag; 503 + String? tag;
504 504
505 _InstanceBuilderFactory( 505 _InstanceBuilderFactory(
506 this.isSingleton, 506 this.isSingleton,
@@ -520,8 +520,8 @@ class _InstanceBuilderFactory<S> { @@ -520,8 +520,8 @@ class _InstanceBuilderFactory<S> {
520 } 520 }
521 521
522 /// Gets the actual instance by it's [builderFunc] or the persisted instance. 522 /// Gets the actual instance by it's [builderFunc] or the persisted instance.
523 - S getDependency() {  
524 - if (isSingleton) { 523 + S? getDependency() {
  524 + if (isSingleton!) {
525 if (dependency == null) { 525 if (dependency == null) {
526 _showInitLog(); 526 _showInitLog();
527 dependency = builderFunc(); 527 dependency = builderFunc();
@@ -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,8 +14,8 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -14,8 +14,8 @@ 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), 21 }) : assert(isScrollControlled != null),
@@ -23,15 +23,15 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -23,15 +23,15 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
23 assert(isDismissible != null), 23 assert(isDismissible != null),
24 assert(enableDrag != null), 24 assert(enableDrag != null),
25 super(settings: settings); 25 super(settings: settings);
26 - final bool isPersistent;  
27 - final WidgetBuilder builder;  
28 - final ThemeData theme; 26 + final bool? isPersistent;
  27 + final WidgetBuilder? builder;
  28 + final ThemeData? theme;
29 final bool isScrollControlled; 29 final bool isScrollControlled;
30 - final Color backgroundColor;  
31 - final double elevation;  
32 - final ShapeBorder shape;  
33 - final Clip clipBehavior;  
34 - final Color modalBarrierColor; 30 + final Color? backgroundColor;
  31 + final double? elevation;
  32 + final ShapeBorder? shape;
  33 + final Clip? clipBehavior;
  34 + final Color? modalBarrierColor;
35 final bool isDismissible; 35 final bool isDismissible;
36 final bool enableDrag; 36 final bool enableDrag;
37 final String name; 37 final String name;
@@ -47,21 +47,21 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -47,21 +47,21 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
47 bool get barrierDismissible => isDismissible; 47 bool get barrierDismissible => isDismissible;
48 48
49 @override 49 @override
50 - final String barrierLabel; 50 + final String? barrierLabel;
51 51
52 @override 52 @override
53 Color get barrierColor => modalBarrierColor ?? Colors.black54; 53 Color get barrierColor => modalBarrierColor ?? Colors.black54;
54 54
55 - AnimationController _animationController; 55 + AnimationController? _animationController;
56 56
57 @override 57 @override
58 AnimationController createAnimationController() { 58 AnimationController createAnimationController() {
59 assert(_animationController == null); 59 assert(_animationController == null);
60 _animationController = 60 _animationController =
61 - BottomSheet.createAnimationController(navigator.overlay);  
62 - _animationController.duration = enterBottomSheetDuration;  
63 - _animationController.reverseDuration = exitBottomSheetDuration;  
64 - return _animationController; 61 + BottomSheet.createAnimationController(navigator!.overlay!);
  62 + _animationController!.duration = enterBottomSheetDuration;
  63 + _animationController!.reverseDuration = exitBottomSheetDuration;
  64 + return _animationController!;
65 } 65 }
66 66
67 @override 67 @override
@@ -91,14 +91,14 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -91,14 +91,14 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
91 ), 91 ),
92 ), 92 ),
93 ); 93 );
94 - if (theme != null) bottomSheet = Theme(data: theme, child: bottomSheet); 94 + if (theme != null) bottomSheet = Theme(data: theme!, child: bottomSheet);
95 return bottomSheet; 95 return bottomSheet;
96 } 96 }
97 } 97 }
98 98
99 class _GetModalBottomSheet<T> extends StatefulWidget { 99 class _GetModalBottomSheet<T> extends StatefulWidget {
100 const _GetModalBottomSheet({ 100 const _GetModalBottomSheet({
101 - Key key, 101 + Key? key,
102 this.route, 102 this.route,
103 this.backgroundColor, 103 this.backgroundColor,
104 this.elevation, 104 this.elevation,
@@ -111,12 +111,12 @@ class _GetModalBottomSheet<T> extends StatefulWidget { @@ -111,12 +111,12 @@ class _GetModalBottomSheet<T> extends StatefulWidget {
111 assert(enableDrag != null), 111 assert(enableDrag != null),
112 super(key: key); 112 super(key: key);
113 final bool isPersistent; 113 final bool isPersistent;
114 - final GetModalBottomSheetRoute<T> route; 114 + final GetModalBottomSheetRoute<T>? route;
115 final bool isScrollControlled; 115 final bool isScrollControlled;
116 - final Color backgroundColor;  
117 - final double elevation;  
118 - final ShapeBorder shape;  
119 - final Clip clipBehavior; 116 + final Color? backgroundColor;
  117 + final double? elevation;
  118 + final ShapeBorder? shape;
  119 + final Clip? clipBehavior;
120 final bool enableDrag; 120 final bool enableDrag;
121 121
122 @override 122 @override
@@ -142,13 +142,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { @@ -142,13 +142,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
142 final routeLabel = _getRouteLabel(localizations); 142 final routeLabel = _getRouteLabel(localizations);
143 143
144 return AnimatedBuilder( 144 return AnimatedBuilder(
145 - animation: widget.route.animation, 145 + animation: widget.route!.animation!,
146 builder: (context, child) { 146 builder: (context, child) {
147 // Disable the initial animation when accessible navigation is on so 147 // Disable the initial animation when accessible navigation is on so
148 // that the semantics are added to the tree at the correct time. 148 // that the semantics are added to the tree at the correct time.
149 final animationValue = mediaQuery.accessibleNavigation 149 final animationValue = mediaQuery.accessibleNavigation
150 ? 1.0 150 ? 1.0
151 - : widget.route.animation.value; 151 + : widget.route!.animation!.value;
152 return Semantics( 152 return Semantics(
153 scopesRoute: true, 153 scopesRoute: true,
154 namesRoute: true, 154 namesRoute: true,
@@ -160,13 +160,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { @@ -160,13 +160,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
160 animationValue, widget.isScrollControlled), 160 animationValue, widget.isScrollControlled),
161 child: widget.isPersistent == false 161 child: widget.isPersistent == false
162 ? BottomSheet( 162 ? BottomSheet(
163 - animationController: widget.route._animationController, 163 + animationController: widget.route!._animationController,
164 onClosing: () { 164 onClosing: () {
165 - if (widget.route.isCurrent) { 165 + if (widget.route!.isCurrent) {
166 Navigator.pop(context); 166 Navigator.pop(context);
167 } 167 }
168 }, 168 },
169 - builder: widget.route.builder, 169 + builder: widget.route!.builder!,
170 backgroundColor: widget.backgroundColor, 170 backgroundColor: widget.backgroundColor,
171 elevation: widget.elevation, 171 elevation: widget.elevation,
172 shape: widget.shape, 172 shape: widget.shape,
@@ -176,13 +176,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { @@ -176,13 +176,13 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
176 : Scaffold( 176 : Scaffold(
177 bottomSheet: BottomSheet( 177 bottomSheet: BottomSheet(
178 animationController: 178 animationController:
179 - widget.route._animationController, 179 + widget.route!._animationController,
180 onClosing: () { 180 onClosing: () {
181 // if (widget.route.isCurrent) { 181 // if (widget.route.isCurrent) {
182 // Navigator.pop(context); 182 // Navigator.pop(context);
183 // } 183 // }
184 }, 184 },
185 - builder: widget.route.builder, 185 + builder: widget.route!.builder!,
186 backgroundColor: widget.backgroundColor, 186 backgroundColor: widget.backgroundColor,
187 elevation: widget.elevation, 187 elevation: widget.elevation,
188 shape: widget.shape, 188 shape: widget.shape,
@@ -199,7 +199,7 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { @@ -199,7 +199,7 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
199 199
200 class _GetPerModalBottomSheet<T> extends StatefulWidget { 200 class _GetPerModalBottomSheet<T> extends StatefulWidget {
201 const _GetPerModalBottomSheet({ 201 const _GetPerModalBottomSheet({
202 - Key key, 202 + Key? key,
203 this.route, 203 this.route,
204 this.isPersistent, 204 this.isPersistent,
205 this.backgroundColor, 205 this.backgroundColor,
@@ -211,13 +211,13 @@ class _GetPerModalBottomSheet<T> extends StatefulWidget { @@ -211,13 +211,13 @@ class _GetPerModalBottomSheet<T> extends StatefulWidget {
211 }) : assert(isScrollControlled != null), 211 }) : assert(isScrollControlled != null),
212 assert(enableDrag != null), 212 assert(enableDrag != null),
213 super(key: key); 213 super(key: key);
214 - final bool isPersistent;  
215 - final GetModalBottomSheetRoute<T> route; 214 + final bool? isPersistent;
  215 + final GetModalBottomSheetRoute<T>? route;
216 final bool isScrollControlled; 216 final bool isScrollControlled;
217 - final Color backgroundColor;  
218 - final double elevation;  
219 - final ShapeBorder shape;  
220 - final Clip clipBehavior; 217 + final Color? backgroundColor;
  218 + final double? elevation;
  219 + final ShapeBorder? shape;
  220 + final Clip? clipBehavior;
221 final bool enableDrag; 221 final bool enableDrag;
222 222
223 @override 223 @override
@@ -247,13 +247,13 @@ class _GetPerModalBottomSheetState<T> @@ -247,13 +247,13 @@ class _GetPerModalBottomSheetState<T>
247 final routeLabel = _getRouteLabel(localizations); 247 final routeLabel = _getRouteLabel(localizations);
248 248
249 return AnimatedBuilder( 249 return AnimatedBuilder(
250 - animation: widget.route.animation, 250 + animation: widget.route!.animation!,
251 builder: (context, child) { 251 builder: (context, child) {
252 // Disable the initial animation when accessible navigation is on so 252 // Disable the initial animation when accessible navigation is on so
253 // that the semantics are added to the tree at the correct time. 253 // that the semantics are added to the tree at the correct time.
254 final animationValue = mediaQuery.accessibleNavigation 254 final animationValue = mediaQuery.accessibleNavigation
255 ? 1.0 255 ? 1.0
256 - : widget.route.animation.value; 256 + : widget.route!.animation!.value;
257 return Semantics( 257 return Semantics(
258 scopesRoute: true, 258 scopesRoute: true,
259 namesRoute: true, 259 namesRoute: true,
@@ -265,13 +265,13 @@ class _GetPerModalBottomSheetState<T> @@ -265,13 +265,13 @@ class _GetPerModalBottomSheetState<T>
265 animationValue, widget.isScrollControlled), 265 animationValue, widget.isScrollControlled),
266 child: widget.isPersistent == false 266 child: widget.isPersistent == false
267 ? BottomSheet( 267 ? BottomSheet(
268 - animationController: widget.route._animationController, 268 + animationController: widget.route!._animationController,
269 onClosing: () { 269 onClosing: () {
270 - if (widget.route.isCurrent) { 270 + if (widget.route!.isCurrent) {
271 Navigator.pop(context); 271 Navigator.pop(context);
272 } 272 }
273 }, 273 },
274 - builder: widget.route.builder, 274 + builder: widget.route!.builder!,
275 backgroundColor: widget.backgroundColor, 275 backgroundColor: widget.backgroundColor,
276 elevation: widget.elevation, 276 elevation: widget.elevation,
277 shape: widget.shape, 277 shape: widget.shape,
@@ -281,13 +281,13 @@ class _GetPerModalBottomSheetState<T> @@ -281,13 +281,13 @@ class _GetPerModalBottomSheetState<T>
281 : Scaffold( 281 : Scaffold(
282 bottomSheet: BottomSheet( 282 bottomSheet: BottomSheet(
283 animationController: 283 animationController:
284 - widget.route._animationController, 284 + widget.route!._animationController,
285 onClosing: () { 285 onClosing: () {
286 // if (widget.route.isCurrent) { 286 // if (widget.route.isCurrent) {
287 // Navigator.pop(context); 287 // Navigator.pop(context);
288 // } 288 // }
289 }, 289 },
290 - builder: widget.route.builder, 290 + builder: widget.route!.builder!,
291 backgroundColor: widget.backgroundColor, 291 backgroundColor: widget.backgroundColor,
292 elevation: widget.elevation, 292 elevation: widget.elevation,
293 shape: widget.shape, 293 shape: widget.shape,
@@ -4,13 +4,13 @@ import '../../../get_instance/src/get_instance.dart'; @@ -4,13 +4,13 @@ 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, 12 + RouteTransitionsBuilder? transitionBuilder,
  13 + RouteSettings? settings,
14 }) : assert(barrierDismissible != null), 14 }) : assert(barrierDismissible != null),
15 widget = pageBuilder, 15 widget = pageBuilder,
16 name = "DIALOG: ${pageBuilder.hashCode}", 16 name = "DIALOG: ${pageBuilder.hashCode}",
@@ -32,15 +32,15 @@ class GetDialogRoute<T> extends PopupRoute<T> { @@ -32,15 +32,15 @@ class GetDialogRoute<T> extends PopupRoute<T> {
32 @override 32 @override
33 void dispose() { 33 void dispose() {
34 if (Get.smartManagement != SmartManagement.onlyBuilder) { 34 if (Get.smartManagement != SmartManagement.onlyBuilder) {
35 - WidgetsBinding.instance.addPostFrameCallback( 35 + WidgetsBinding.instance!.addPostFrameCallback(
36 (_) => GetInstance().removeDependencyByRoute(name)); 36 (_) => GetInstance().removeDependencyByRoute(name));
37 } 37 }
38 super.dispose(); 38 super.dispose();
39 } 39 }
40 40
41 @override 41 @override
42 - String get barrierLabel => _barrierLabel;  
43 - final String _barrierLabel; 42 + String? get barrierLabel => _barrierLabel;
  43 + final String? _barrierLabel;
44 44
45 @override 45 @override
46 Color get barrierColor => _barrierColor; 46 Color get barrierColor => _barrierColor;
@@ -50,7 +50,7 @@ class GetDialogRoute<T> extends PopupRoute<T> { @@ -50,7 +50,7 @@ class GetDialogRoute<T> extends PopupRoute<T> {
50 Duration get transitionDuration => _transitionDuration; 50 Duration get transitionDuration => _transitionDuration;
51 final Duration _transitionDuration; 51 final Duration _transitionDuration;
52 52
53 - final RouteTransitionsBuilder _transitionBuilder; 53 + final RouteTransitionsBuilder? _transitionBuilder;
54 54
55 @override 55 @override
56 Widget buildPage(BuildContext context, Animation<double> animation, 56 Widget buildPage(BuildContext context, Animation<double> animation,
@@ -73,6 +73,6 @@ class GetDialogRoute<T> extends PopupRoute<T> { @@ -73,6 +73,6 @@ class GetDialogRoute<T> extends PopupRoute<T> {
73 ), 73 ),
74 child: child); 74 child: child);
75 } // Some default transition 75 } // Some default transition
76 - return _transitionBuilder(context, animation, secondaryAnimation, child); 76 + return _transitionBuilder!(context, animation, secondaryAnimation, child);
77 } 77 }
78 } 78 }
@@ -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,56 +92,56 @@ extension ExtensionSnackbar on GetInterface { @@ -92,56 +92,56 @@ 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,
@@ -200,7 +200,7 @@ extension ExtensionSnackbar on GetInterface { @@ -200,7 +200,7 @@ extension ExtensionSnackbar on GetInterface {
200 showSnackbar<T>(getBar); 200 showSnackbar<T>(getBar);
201 } else { 201 } else {
202 routing.isSnackbar = true; 202 routing.isSnackbar = true;
203 - SchedulerBinding.instance.addPostFrameCallback((_) { 203 + SchedulerBinding.instance!.addPostFrameCallback((_) {
204 showSnackbar<T>(getBar); 204 showSnackbar<T>(getBar);
205 }); 205 });
206 } 206 }
@@ -212,26 +212,26 @@ extension ExtensionDialog on GetInterface { @@ -212,26 +212,26 @@ extension ExtensionDialog on GetInterface {
212 /// You can pass a [transitionDuration] and/or [transitionCurve], 212 /// You can pass a [transitionDuration] and/or [transitionCurve],
213 /// overriding the defaults when the dialog shows up and closes. 213 /// overriding the defaults when the dialog shows up and closes.
214 /// When the dialog closes, uses those animations in reverse. 214 /// When the dialog closes, uses those animations in reverse.
215 - Future<T> dialog<T>( 215 + Future<T?> dialog<T>(
216 Widget widget, { 216 Widget widget, {
217 bool barrierDismissible = true, 217 bool barrierDismissible = true,
218 - Color barrierColor, 218 + Color? barrierColor,
219 bool useSafeArea = true, 219 bool useSafeArea = true,
220 bool useRootNavigator = true, 220 bool useRootNavigator = true,
221 - Object arguments,  
222 - Duration transitionDuration,  
223 - Curve transitionCurve,  
224 - String name,  
225 - RouteSettings routeSettings, 221 + Object? arguments,
  222 + Duration? transitionDuration,
  223 + Curve? transitionCurve,
  224 + String? name,
  225 + RouteSettings? routeSettings,
226 }) { 226 }) {
227 assert(widget != null); 227 assert(widget != null);
228 assert(barrierDismissible != null); 228 assert(barrierDismissible != null);
229 assert(useSafeArea != null); 229 assert(useSafeArea != null);
230 assert(useRootNavigator != null); 230 assert(useRootNavigator != null);
231 - assert(debugCheckHasMaterialLocalizations(context)); 231 + assert(debugCheckHasMaterialLocalizations(context!));
232 232
233 // final theme = Theme.of(context, shadowThemeOnly: true); 233 // final theme = Theme.of(context, shadowThemeOnly: true);
234 - final theme = Theme.of(context); 234 + final theme = Theme.of(context!);
235 return generalDialog<T>( 235 return generalDialog<T>(
236 pageBuilder: (buildContext, animation, secondaryAnimation) { 236 pageBuilder: (buildContext, animation, secondaryAnimation) {
237 final pageChild = widget; 237 final pageChild = widget;
@@ -246,7 +246,7 @@ extension ExtensionDialog on GetInterface { @@ -246,7 +246,7 @@ extension ExtensionDialog on GetInterface {
246 return dialog; 246 return dialog;
247 }, 247 },
248 barrierDismissible: barrierDismissible, 248 barrierDismissible: barrierDismissible,
249 - barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, 249 + barrierLabel: MaterialLocalizations.of(context!).modalBarrierDismissLabel,
250 barrierColor: barrierColor ?? Colors.black54, 250 barrierColor: barrierColor ?? Colors.black54,
251 transitionDuration: transitionDuration ?? defaultDialogTransitionDuration, 251 transitionDuration: transitionDuration ?? defaultDialogTransitionDuration,
252 transitionBuilder: (context, animation, secondaryAnimation, child) { 252 transitionBuilder: (context, animation, secondaryAnimation, child) {
@@ -265,20 +265,20 @@ extension ExtensionDialog on GetInterface { @@ -265,20 +265,20 @@ extension ExtensionDialog on GetInterface {
265 } 265 }
266 266
267 /// Api from showGeneralDialog with no context 267 /// Api from showGeneralDialog with no context
268 - Future<T> generalDialog<T>({  
269 - @required RoutePageBuilder pageBuilder, 268 + Future<T?> generalDialog<T>({
  269 + required RoutePageBuilder pageBuilder,
270 bool barrierDismissible = false, 270 bool barrierDismissible = false,
271 - String barrierLabel, 271 + String? barrierLabel,
272 Color barrierColor = const Color(0x80000000), 272 Color barrierColor = const Color(0x80000000),
273 Duration transitionDuration = const Duration(milliseconds: 200), 273 Duration transitionDuration = const Duration(milliseconds: 200),
274 - RouteTransitionsBuilder transitionBuilder, 274 + RouteTransitionsBuilder? transitionBuilder,
275 bool useRootNavigator = true, 275 bool useRootNavigator = true,
276 - RouteSettings routeSettings, 276 + RouteSettings? routeSettings,
277 }) { 277 }) {
278 assert(pageBuilder != null); 278 assert(pageBuilder != null);
279 assert(useRootNavigator != null); 279 assert(useRootNavigator != null);
280 assert(!barrierDismissible || barrierLabel != null); 280 assert(!barrierDismissible || barrierLabel != null);
281 - return Navigator.of(overlayContext, rootNavigator: useRootNavigator) 281 + return Navigator.of(overlayContext!, rootNavigator: useRootNavigator)
282 .push<T>(GetDialogRoute<T>( 282 .push<T>(GetDialogRoute<T>(
283 pageBuilder: pageBuilder, 283 pageBuilder: pageBuilder,
284 barrierDismissible: barrierDismissible, 284 barrierDismissible: barrierDismissible,
@@ -291,32 +291,32 @@ extension ExtensionDialog on GetInterface { @@ -291,32 +291,32 @@ extension ExtensionDialog on GetInterface {
291 } 291 }
292 292
293 /// Custom UI Dialog. 293 /// Custom UI Dialog.
294 - Future<T> defaultDialog<T>({ 294 + Future<T?> defaultDialog<T>({
295 String title = "Alert", 295 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, 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,
310 bool barrierDismissible = true, 310 bool barrierDismissible = true,
311 - Color buttonColor, 311 + Color? buttonColor,
312 String middleText = "Dialog made in 3 lines of code", 312 String middleText = "Dialog made in 3 lines of code",
313 - TextStyle middleTextStyle, 313 + TextStyle? middleTextStyle,
314 double radius = 20.0, 314 double radius = 20.0,
315 // ThemeData themeData, 315 // ThemeData themeData,
316 - List<Widget> actions, 316 + List<Widget>? actions,
317 317
318 // onWillPop Scope 318 // onWillPop Scope
319 - WillPopCallback onWillPop, 319 + WillPopCallback? onWillPop,
320 }) { 320 }) {
321 var leanCancel = onCancel != null || textCancel != null; 321 var leanCancel = onCancel != null || textCancel != null;
322 var leanConfirm = onConfirm != null || textConfirm != null; 322 var leanConfirm = onConfirm != null || textConfirm != null;
@@ -332,7 +332,7 @@ extension ExtensionDialog on GetInterface { @@ -332,7 +332,7 @@ extension ExtensionDialog on GetInterface {
332 padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), 332 padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8),
333 shape: RoundedRectangleBorder( 333 shape: RoundedRectangleBorder(
334 side: BorderSide( 334 side: BorderSide(
335 - color: buttonColor ?? theme.accentColor, 335 + color: buttonColor ?? theme!.accentColor,
336 width: 2, 336 width: 2,
337 style: BorderStyle.solid), 337 style: BorderStyle.solid),
338 borderRadius: BorderRadius.circular(100)), 338 borderRadius: BorderRadius.circular(100)),
@@ -343,7 +343,7 @@ extension ExtensionDialog on GetInterface { @@ -343,7 +343,7 @@ extension ExtensionDialog on GetInterface {
343 }, 343 },
344 child: Text( 344 child: Text(
345 textCancel ?? "Cancel", 345 textCancel ?? "Cancel",
346 - style: TextStyle(color: cancelTextColor ?? theme.accentColor), 346 + style: TextStyle(color: cancelTextColor ?? theme!.accentColor),
347 ), 347 ),
348 )); 348 ));
349 } 349 }
@@ -356,14 +356,14 @@ extension ExtensionDialog on GetInterface { @@ -356,14 +356,14 @@ extension ExtensionDialog on GetInterface {
356 style: TextButton.styleFrom( 356 style: TextButton.styleFrom(
357 tapTargetSize: MaterialTapTargetSize.shrinkWrap, 357 tapTargetSize: MaterialTapTargetSize.shrinkWrap,
358 //color: buttonColor ?? theme.accentColor, 358 //color: buttonColor ?? theme.accentColor,
359 - backgroundColor: buttonColor ?? theme.accentColor, 359 + backgroundColor: buttonColor ?? theme!.accentColor,
360 shape: RoundedRectangleBorder( 360 shape: RoundedRectangleBorder(
361 borderRadius: BorderRadius.circular(100)), 361 borderRadius: BorderRadius.circular(100)),
362 ), 362 ),
363 child: Text( 363 child: Text(
364 textConfirm ?? "Ok", 364 textConfirm ?? "Ok",
365 style: 365 style:
366 - TextStyle(color: confirmTextColor ?? theme.backgroundColor), 366 + TextStyle(color: confirmTextColor ?? theme!.backgroundColor),
367 ), 367 ),
368 onPressed: () { 368 onPressed: () {
369 onConfirm?.call(); 369 onConfirm?.call();
@@ -374,7 +374,7 @@ extension ExtensionDialog on GetInterface { @@ -374,7 +374,7 @@ extension ExtensionDialog on GetInterface {
374 Widget baseAlertDialog = AlertDialog( 374 Widget baseAlertDialog = AlertDialog(
375 titlePadding: EdgeInsets.all(8), 375 titlePadding: EdgeInsets.all(8),
376 contentPadding: EdgeInsets.all(8), 376 contentPadding: EdgeInsets.all(8),
377 - backgroundColor: backgroundColor ?? theme.dialogBackgroundColor, 377 + backgroundColor: backgroundColor ?? theme!.dialogBackgroundColor,
378 shape: RoundedRectangleBorder( 378 shape: RoundedRectangleBorder(
379 borderRadius: BorderRadius.all(Radius.circular(radius))), 379 borderRadius: BorderRadius.all(Radius.circular(radius))),
380 title: Text(title, textAlign: TextAlign.center, style: titleStyle), 380 title: Text(title, textAlign: TextAlign.center, style: titleStyle),
@@ -420,22 +420,22 @@ extension ExtensionDialog on GetInterface { @@ -420,22 +420,22 @@ extension ExtensionDialog on GetInterface {
420 } 420 }
421 421
422 extension ExtensionBottomSheet on GetInterface { 422 extension ExtensionBottomSheet on GetInterface {
423 - Future<T> bottomSheet<T>( 423 + Future<T?> bottomSheet<T>(
424 Widget bottomsheet, { 424 Widget bottomsheet, {
425 - Color backgroundColor,  
426 - double elevation, 425 + Color? backgroundColor,
  426 + double? elevation,
427 bool persistent = true, 427 bool persistent = true,
428 - ShapeBorder shape,  
429 - Clip clipBehavior,  
430 - Color barrierColor,  
431 - bool ignoreSafeArea, 428 + ShapeBorder? shape,
  429 + Clip? clipBehavior,
  430 + Color? barrierColor,
  431 + bool? ignoreSafeArea,
432 bool isScrollControlled = false, 432 bool isScrollControlled = false,
433 bool useRootNavigator = false, 433 bool useRootNavigator = false,
434 bool isDismissible = true, 434 bool isDismissible = true,
435 bool enableDrag = true, 435 bool enableDrag = true,
436 - RouteSettings settings,  
437 - Duration enterBottomSheetDuration,  
438 - Duration exitBottomSheetDuration, 436 + RouteSettings? settings,
  437 + Duration? enterBottomSheetDuration,
  438 + Duration? exitBottomSheetDuration,
439 }) { 439 }) {
440 assert(bottomsheet != null); 440 assert(bottomsheet != null);
441 assert(persistent != null); 441 assert(persistent != null);
@@ -444,15 +444,15 @@ extension ExtensionBottomSheet on GetInterface { @@ -444,15 +444,15 @@ extension ExtensionBottomSheet on GetInterface {
444 assert(isDismissible != null); 444 assert(isDismissible != null);
445 assert(enableDrag != null); 445 assert(enableDrag != null);
446 446
447 - return Navigator.of(overlayContext, rootNavigator: useRootNavigator) 447 + return Navigator.of(overlayContext!, rootNavigator: useRootNavigator)
448 .push(GetModalBottomSheetRoute<T>( 448 .push(GetModalBottomSheetRoute<T>(
449 builder: (_) => bottomsheet, 449 builder: (_) => bottomsheet,
450 isPersistent: persistent, 450 isPersistent: persistent,
451 // theme: Theme.of(key.currentContext, shadowThemeOnly: true), 451 // theme: Theme.of(key.currentContext, shadowThemeOnly: true),
452 - theme: Theme.of(key.currentContext), 452 + theme: Theme.of(key!.currentContext!),
453 isScrollControlled: isScrollControlled, 453 isScrollControlled: isScrollControlled,
454 - barrierLabel:  
455 - MaterialLocalizations.of(key.currentContext).modalBarrierDismissLabel, 454 + barrierLabel: MaterialLocalizations.of(key!.currentContext!)
  455 + .modalBarrierDismissLabel,
456 backgroundColor: backgroundColor ?? Colors.transparent, 456 backgroundColor: backgroundColor ?? Colors.transparent,
457 elevation: elevation, 457 elevation: elevation,
458 shape: shape, 458 shape: shape,
@@ -491,18 +491,18 @@ extension GetNavigation on GetInterface { @@ -491,18 +491,18 @@ extension GetNavigation on GetInterface {
491 /// 491 ///
492 /// By default, GetX will prevent you from push a route that you already in, 492 /// 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 493 /// if you want to push anyway, set [preventDuplicates] to false
494 - Future<T> to<T>( 494 + Future<T?>? to<T>(
495 dynamic page, { 495 dynamic page, {
496 - bool opaque,  
497 - Transition transition,  
498 - Curve curve,  
499 - Duration duration,  
500 - int id, 496 + bool? opaque,
  497 + Transition? transition,
  498 + Curve? curve,
  499 + Duration? duration,
  500 + int? id,
501 bool fullscreenDialog = false, 501 bool fullscreenDialog = false,
502 dynamic arguments, 502 dynamic arguments,
503 - Bindings binding, 503 + Bindings? binding,
504 bool preventDuplicates = true, 504 bool preventDuplicates = true,
505 - bool popGesture, 505 + bool? popGesture,
506 }) { 506 }) {
507 var routeName = "/${page.runtimeType.toString()}"; 507 var routeName = "/${page.runtimeType.toString()}";
508 if (preventDuplicates && routeName == currentRoute) { 508 if (preventDuplicates && routeName == currentRoute) {
@@ -558,12 +558,12 @@ you can only use widgets and widget functions here'''; @@ -558,12 +558,12 @@ you can only use widgets and widget functions here''';
558 /// if you want to push anyway, set [preventDuplicates] to false 558 /// if you want to push anyway, set [preventDuplicates] to false
559 /// 559 ///
560 /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors 560 /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors
561 - Future<T> toNamed<T>( 561 + Future<T?>? toNamed<T>(
562 String page, { 562 String page, {
563 dynamic arguments, 563 dynamic arguments,
564 - int id, 564 + int? id,
565 bool preventDuplicates = true, 565 bool preventDuplicates = true,
566 - Map<String, String> parameters, 566 + Map<String, String>? parameters,
567 }) { 567 }) {
568 if (preventDuplicates && page == currentRoute) { 568 if (preventDuplicates && page == currentRoute) {
569 return null; 569 return null;
@@ -596,12 +596,12 @@ you can only use widgets and widget functions here'''; @@ -596,12 +596,12 @@ you can only use widgets and widget functions here''';
596 /// if you want to push anyway, set [preventDuplicates] to false 596 /// if you want to push anyway, set [preventDuplicates] to false
597 /// 597 ///
598 /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors 598 /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors
599 - Future<T> offNamed<T>( 599 + Future<T?>? offNamed<T>(
600 String page, { 600 String page, {
601 dynamic arguments, 601 dynamic arguments,
602 - int id, 602 + int? id,
603 bool preventDuplicates = true, 603 bool preventDuplicates = true,
604 - Map<String, String> parameters, 604 + Map<String, String>? parameters,
605 }) { 605 }) {
606 if (preventDuplicates && page == currentRoute) { 606 if (preventDuplicates && page == currentRoute) {
607 return null; 607 return null;
@@ -630,7 +630,7 @@ you can only use widgets and widget functions here'''; @@ -630,7 +630,7 @@ you can only use widgets and widget functions here''';
630 /// or also like this: 630 /// or also like this:
631 /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the 631 /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the
632 /// dialog is closed 632 /// dialog is closed
633 - void until(RoutePredicate predicate, {int id}) { 633 + void until(RoutePredicate predicate, {int? id}) {
634 // if (key.currentState.mounted) // add this if appear problems on future with route navigate 634 // if (key.currentState.mounted) // add this if appear problems on future with route navigate
635 // when widget don't mounted 635 // when widget don't mounted
636 return global(id)?.currentState?.popUntil(predicate); 636 return global(id)?.currentState?.popUntil(predicate);
@@ -654,7 +654,7 @@ you can only use widgets and widget functions here'''; @@ -654,7 +654,7 @@ you can only use widgets and widget functions here''';
654 /// or also like this: 654 /// or also like this:
655 /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog 655 /// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog
656 /// is closed 656 /// is closed
657 - Future<T> offUntil<T>(Route<T> page, RoutePredicate predicate, {int id}) { 657 + 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 658 // if (key.currentState.mounted) // add this if appear problems on future with route navigate
659 // when widget don't mounted 659 // when widget don't mounted
660 return global(id)?.currentState?.pushAndRemoveUntil<T>(page, predicate); 660 return global(id)?.currentState?.pushAndRemoveUntil<T>(page, predicate);
@@ -678,12 +678,12 @@ you can only use widgets and widget functions here'''; @@ -678,12 +678,12 @@ you can only use widgets and widget functions here''';
678 /// to make sure the dialog is closed 678 /// to make sure the dialog is closed
679 /// 679 ///
680 /// Note: Always put a slash on the route name ('/page1'), to avoid unexpected errors 680 /// Note: Always put a slash on the route name ('/page1'), to avoid unexpected errors
681 - Future<T> offNamedUntil<T>( 681 + Future<T?>? offNamedUntil<T>(
682 String page, 682 String page,
683 RoutePredicate predicate, { 683 RoutePredicate predicate, {
684 - int id, 684 + int? id,
685 dynamic arguments, 685 dynamic arguments,
686 - Map<String, String> parameters, 686 + Map<String, String>? parameters,
687 }) { 687 }) {
688 if (parameters != null) { 688 if (parameters != null) {
689 final uri = Uri(path: page, queryParameters: parameters); 689 final uri = Uri(path: page, queryParameters: parameters);
@@ -708,12 +708,12 @@ you can only use widgets and widget functions here'''; @@ -708,12 +708,12 @@ you can only use widgets and widget functions here''';
708 /// The `offNamed()` pop a page, and goes to the next. The 708 /// The `offNamed()` pop a page, and goes to the next. The
709 /// `offAndToNamed()` goes to the next page, and removes the previous one. 709 /// `offAndToNamed()` goes to the next page, and removes the previous one.
710 /// The route transition animation is different. 710 /// The route transition animation is different.
711 - Future<T> offAndToNamed<T>( 711 + Future<T?>? offAndToNamed<T>(
712 String page, { 712 String page, {
713 dynamic arguments, 713 dynamic arguments,
714 - int id, 714 + int? id,
715 dynamic result, 715 dynamic result,
716 - Map<String, String> parameters, 716 + Map<String, String>? parameters,
717 }) { 717 }) {
718 if (parameters != null) { 718 if (parameters != null) {
719 final uri = Uri(path: page, queryParameters: parameters); 719 final uri = Uri(path: page, queryParameters: parameters);
@@ -732,7 +732,7 @@ you can only use widgets and widget functions here'''; @@ -732,7 +732,7 @@ you can only use widgets and widget functions here''';
732 /// 732 ///
733 /// [id] is for when you are using nested navigation, 733 /// [id] is for when you are using nested navigation,
734 /// as explained in documentation 734 /// as explained in documentation
735 - void removeRoute(Route<dynamic> route, {int id}) { 735 + void removeRoute(Route<dynamic> route, {int? id}) {
736 return global(id)?.currentState?.removeRoute(route); 736 return global(id)?.currentState?.removeRoute(route);
737 } 737 }
738 738
@@ -756,12 +756,12 @@ you can only use widgets and widget functions here'''; @@ -756,12 +756,12 @@ you can only use widgets and widget functions here''';
756 /// as explained in documentation 756 /// as explained in documentation
757 /// 757 ///
758 /// Note: Always put a slash on the route ('/page1'), to avoid unexpected errors 758 /// Note: Always put a slash on the route ('/page1'), to avoid unexpected errors
759 - Future<T> offAllNamed<T>( 759 + Future<T?>? offAllNamed<T>(
760 String newRouteName, { 760 String newRouteName, {
761 - RoutePredicate predicate, 761 + RoutePredicate? predicate,
762 dynamic arguments, 762 dynamic arguments,
763 - int id,  
764 - Map<String, String> parameters, 763 + int? id,
  764 + Map<String, String>? parameters,
765 }) { 765 }) {
766 if (parameters != null) { 766 if (parameters != null) {
767 final uri = Uri(path: newRouteName, queryParameters: parameters); 767 final uri = Uri(path: newRouteName, queryParameters: parameters);
@@ -777,11 +777,11 @@ you can only use widgets and widget functions here'''; @@ -777,11 +777,11 @@ you can only use widgets and widget functions here''';
777 777
778 /// Returns true if a Snackbar, Dialog or BottomSheet is currently OPEN 778 /// Returns true if a Snackbar, Dialog or BottomSheet is currently OPEN
779 bool get isOverlaysOpen => 779 bool get isOverlaysOpen =>
780 - (isSnackbarOpen || isDialogOpen || isBottomSheetOpen); 780 + (isSnackbarOpen! || isDialogOpen! || isBottomSheetOpen!);
781 781
782 /// Returns true if there is no Snackbar, Dialog or BottomSheet open 782 /// Returns true if there is no Snackbar, Dialog or BottomSheet open
783 bool get isOverlaysClosed => 783 bool get isOverlaysClosed =>
784 - (!isSnackbarOpen && !isDialogOpen && !isBottomSheetOpen); 784 + (!isSnackbarOpen! && !isDialogOpen! && !isBottomSheetOpen!);
785 785
786 /// **Navigation.popUntil()** shortcut.<br><br> 786 /// **Navigation.popUntil()** shortcut.<br><br>
787 /// 787 ///
@@ -796,10 +796,10 @@ you can only use widgets and widget functions here'''; @@ -796,10 +796,10 @@ you can only use widgets and widget functions here''';
796 /// It has the advantage of not needing context, so you can call 796 /// It has the advantage of not needing context, so you can call
797 /// from your business logic. 797 /// from your business logic.
798 void back<T>({ 798 void back<T>({
799 - T result, 799 + T? result,
800 bool closeOverlays = false, 800 bool closeOverlays = false,
801 bool canPop = true, 801 bool canPop = true,
802 - int id, 802 + int? id,
803 }) { 803 }) {
804 if (closeOverlays && isOverlaysOpen) { 804 if (closeOverlays && isOverlaysOpen) {
805 navigator?.popUntil((route) { 805 navigator?.popUntil((route) {
@@ -821,7 +821,7 @@ you can only use widgets and widget functions here'''; @@ -821,7 +821,7 @@ you can only use widgets and widget functions here''';
821 /// 821 ///
822 /// [id] is for when you are using nested navigation, 822 /// [id] is for when you are using nested navigation,
823 /// as explained in documentation 823 /// as explained in documentation
824 - void close(int times, [int id]) { 824 + void close(int times, [int? id]) {
825 if ((times == null) || (times < 1)) { 825 if ((times == null) || (times < 1)) {
826 times = 1; 826 times = 1;
827 } 827 }
@@ -856,18 +856,18 @@ you can only use widgets and widget functions here'''; @@ -856,18 +856,18 @@ you can only use widgets and widget functions here''';
856 /// 856 ///
857 /// By default, GetX will prevent you from push a route that you already in, 857 /// 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 858 /// if you want to push anyway, set [preventDuplicates] to false
859 - Future<T> off<T>( 859 + Future<T?>? off<T>(
860 dynamic page, { 860 dynamic page, {
861 bool opaque = false, 861 bool opaque = false,
862 - Transition transition,  
863 - Curve curve,  
864 - bool popGesture,  
865 - int id, 862 + Transition? transition,
  863 + Curve? curve,
  864 + bool? popGesture,
  865 + int? id,
866 dynamic arguments, 866 dynamic arguments,
867 - Bindings binding, 867 + Bindings? binding,
868 bool fullscreenDialog = false, 868 bool fullscreenDialog = false,
869 bool preventDuplicates = true, 869 bool preventDuplicates = true,
870 - Duration duration, 870 + Duration? duration,
871 }) { 871 }) {
872 var routeName = "/${page.runtimeType.toString()}"; 872 var routeName = "/${page.runtimeType.toString()}";
873 if (preventDuplicates && routeName == currentRoute) { 873 if (preventDuplicates && routeName == currentRoute) {
@@ -917,18 +917,18 @@ you can only use widgets and widget functions here'''; @@ -917,18 +917,18 @@ you can only use widgets and widget functions here''';
917 /// 917 ///
918 /// By default, GetX will prevent you from push a route that you already in, 918 /// 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 919 /// if you want to push anyway, set [preventDuplicates] to false
920 - Future<T> offAll<T>( 920 + Future<T?>? offAll<T>(
921 dynamic page, { 921 dynamic page, {
922 - RoutePredicate predicate, 922 + RoutePredicate? predicate,
923 bool opaque = false, 923 bool opaque = false,
924 - bool popGesture,  
925 - int id, 924 + bool? popGesture,
  925 + int? id,
926 dynamic arguments, 926 dynamic arguments,
927 - Bindings binding, 927 + Bindings? binding,
928 bool fullscreenDialog = false, 928 bool fullscreenDialog = false,
929 - Transition transition,  
930 - Curve curve,  
931 - Duration duration, 929 + Transition? transition,
  930 + Curve? curve,
  931 + Duration? duration,
932 }) { 932 }) {
933 var routeName = "/${page.runtimeType.toString()}"; 933 var routeName = "/${page.runtimeType.toString()}";
934 934
@@ -948,32 +948,32 @@ you can only use widgets and widget functions here'''; @@ -948,32 +948,32 @@ you can only use widgets and widget functions here''';
948 predicate ?? (route) => false); 948 predicate ?? (route) => false);
949 } 949 }
950 950
951 - void addPages(List<GetPage> getPages) { 951 + void addPages(List<GetPage>? getPages) {
952 if (getPages != null) { 952 if (getPages != null) {
953 if (routeTree == null) { 953 if (routeTree == null) {
954 routeTree = ParseRouteTree(); 954 routeTree = ParseRouteTree();
955 } 955 }
956 956
957 - routeTree.addRoutes(getPages); 957 + routeTree!.addRoutes(getPages);
958 } 958 }
959 } 959 }
960 960
961 void addPage(GetPage getPage) { 961 void addPage(GetPage getPage) {
962 if (getPage != null) { 962 if (getPage != null) {
963 if (routeTree == null) routeTree = ParseRouteTree(); 963 if (routeTree == null) routeTree = ParseRouteTree();
964 - routeTree.addRoute(getPage); 964 + routeTree!.addRoute(getPage);
965 } 965 }
966 } 966 }
967 967
968 /// change default config of Get 968 /// change default config of Get
969 void config( 969 void config(
970 - {bool enableLog,  
971 - LogWriterCallback logWriterCallback,  
972 - bool defaultPopGesture,  
973 - bool defaultOpaqueRoute,  
974 - Duration defaultDurationTransition,  
975 - bool defaultGlobalState,  
976 - Transition defaultTransition}) { 970 + {bool? enableLog,
  971 + LogWriterCallback? logWriterCallback,
  972 + bool? defaultPopGesture,
  973 + bool? defaultOpaqueRoute,
  974 + Duration? defaultDurationTransition,
  975 + bool? defaultGlobalState,
  976 + Transition? defaultTransition}) {
977 if (enableLog != null) { 977 if (enableLog != null) {
978 Get.isLogEnable = enableLog; 978 Get.isLogEnable = enableLog;
979 } 979 }
@@ -1014,7 +1014,7 @@ you can only use widgets and widget functions here'''; @@ -1014,7 +1014,7 @@ you can only use widgets and widget functions here''';
1014 /// Your entire application will be rebuilt, and touch events will not 1014 /// Your entire application will be rebuilt, and touch events will not
1015 /// work until the end of rendering. 1015 /// work until the end of rendering.
1016 void forceAppUpdate() { 1016 void forceAppUpdate() {
1017 - engine.performReassemble(); 1017 + engine!.performReassemble();
1018 } 1018 }
1019 1019
1020 void appUpdate() => getxController.update(); 1020 void appUpdate() => getxController.update();
@@ -1027,18 +1027,18 @@ you can only use widgets and widget functions here'''; @@ -1027,18 +1027,18 @@ you can only use widgets and widget functions here''';
1027 getxController.setThemeMode(themeMode); 1027 getxController.setThemeMode(themeMode);
1028 } 1028 }
1029 1029
1030 - GlobalKey<NavigatorState> addKey(GlobalKey<NavigatorState> newKey) { 1030 + GlobalKey<NavigatorState>? addKey(GlobalKey<NavigatorState>? newKey) {
1031 getxController.key = newKey; 1031 getxController.key = newKey;
1032 return key; 1032 return key;
1033 } 1033 }
1034 1034
1035 - GlobalKey<NavigatorState> nestedKey(int key) { 1035 + GlobalKey<NavigatorState>? nestedKey(int key) {
1036 keys.putIfAbsent(key, () => GlobalKey<NavigatorState>()); 1036 keys.putIfAbsent(key, () => GlobalKey<NavigatorState>());
1037 return keys[key]; 1037 return keys[key];
1038 } 1038 }
1039 1039
1040 - GlobalKey<NavigatorState> global(int k) {  
1041 - GlobalKey<NavigatorState> _key; 1040 + GlobalKey<NavigatorState>? global(int? k) {
  1041 + GlobalKey<NavigatorState>? _key;
1042 if (k == null) { 1042 if (k == null) {
1043 _key = key; 1043 _key = key;
1044 } else { 1044 } else {
@@ -1048,7 +1048,7 @@ you can only use widgets and widget functions here'''; @@ -1048,7 +1048,7 @@ you can only use widgets and widget functions here''';
1048 _key = keys[k]; 1048 _key = keys[k];
1049 } 1049 }
1050 1050
1051 - if (_key.currentContext == null && !testMode) { 1051 + if (_key!.currentContext == null && !testMode) {
1052 throw """You are trying to use contextless navigation without 1052 throw """You are trying to use contextless navigation without
1053 a GetMaterialApp or Get.key. 1053 a GetMaterialApp or Get.key.
1054 If you are testing your app, you can use: 1054 If you are testing your app, you can use:
@@ -1065,7 +1065,7 @@ you can only use widgets and widget functions here'''; @@ -1065,7 +1065,7 @@ you can only use widgets and widget functions here''';
1065 Since version 2.8 it is possible to access the properties 1065 Since version 2.8 it is possible to access the properties
1066 [Get.arguments] and [Get.currentRoute] directly. 1066 [Get.arguments] and [Get.currentRoute] directly.
1067 [routeSettings] is useless and should not be used.''') 1067 [routeSettings] is useless and should not be used.''')
1068 - RouteSettings get routeSettings => null; 1068 + RouteSettings? get routeSettings => null;
1069 1069
1070 /// give current arguments 1070 /// give current arguments
1071 dynamic get arguments => routing.args; 1071 dynamic get arguments => routing.args;
@@ -1077,16 +1077,16 @@ Since version 2.8 it is possible to access the properties @@ -1077,16 +1077,16 @@ Since version 2.8 it is possible to access the properties
1077 String get previousRoute => routing.previous; 1077 String get previousRoute => routing.previous;
1078 1078
1079 /// check if snackbar is open 1079 /// check if snackbar is open
1080 - bool get isSnackbarOpen => routing.isSnackbar; 1080 + bool? get isSnackbarOpen => routing.isSnackbar;
1081 1081
1082 /// check if dialog is open 1082 /// check if dialog is open
1083 - bool get isDialogOpen => routing.isDialog; 1083 + bool? get isDialogOpen => routing.isDialog;
1084 1084
1085 /// check if bottomsheet is open 1085 /// check if bottomsheet is open
1086 - bool get isBottomSheetOpen => routing.isBottomSheet; 1086 + bool? get isBottomSheetOpen => routing.isBottomSheet;
1087 1087
1088 /// check a raw current route 1088 /// check a raw current route
1089 - Route<dynamic> get rawRoute => routing.route; 1089 + Route<dynamic>? get rawRoute => routing.route;
1090 1090
1091 /// check if popGesture is enable 1091 /// check if popGesture is enable
1092 bool get isPopGestureEnable => defaultPopGesture; 1092 bool get isPopGestureEnable => defaultPopGesture;
@@ -1095,11 +1095,11 @@ Since version 2.8 it is possible to access the properties @@ -1095,11 +1095,11 @@ Since version 2.8 it is possible to access the properties
1095 bool get isOpaqueRouteDefault => defaultOpaqueRoute; 1095 bool get isOpaqueRouteDefault => defaultOpaqueRoute;
1096 1096
1097 /// give access to currentContext 1097 /// give access to currentContext
1098 - BuildContext get context => key?.currentContext; 1098 + BuildContext? get context => key?.currentContext;
1099 1099
1100 /// give access to current Overlay Context 1100 /// give access to current Overlay Context
1101 - BuildContext get overlayContext {  
1102 - BuildContext overlay; 1101 + BuildContext? get overlayContext {
  1102 + BuildContext? overlay;
1103 key?.currentState?.overlay?.context?.visitChildElements((element) { 1103 key?.currentState?.overlay?.context?.visitChildElements((element) {
1104 overlay = element; 1104 overlay = element;
1105 }); 1105 });
@@ -1107,16 +1107,16 @@ Since version 2.8 it is possible to access the properties @@ -1107,16 +1107,16 @@ Since version 2.8 it is possible to access the properties
1107 } 1107 }
1108 1108
1109 /// give access to Theme.of(context) 1109 /// give access to Theme.of(context)
1110 - ThemeData get theme {  
1111 - ThemeData _theme; 1110 + ThemeData? get theme {
  1111 + ThemeData? _theme;
1112 if (context != null) { 1112 if (context != null) {
1113 - _theme = Theme.of(context); 1113 + _theme = Theme.of(context!);
1114 } 1114 }
1115 return _theme; 1115 return _theme;
1116 } 1116 }
1117 1117
1118 ///The current [WidgetsBinding] 1118 ///The current [WidgetsBinding]
1119 - WidgetsBinding get engine { 1119 + WidgetsBinding? get engine {
1120 if (WidgetsBinding.instance == null) { 1120 if (WidgetsBinding.instance == null) {
1121 WidgetsFlutterBinding(); 1121 WidgetsFlutterBinding();
1122 } 1122 }
@@ -1153,23 +1153,23 @@ Since version 2.8 it is possible to access the properties @@ -1153,23 +1153,23 @@ Since version 2.8 it is possible to access the properties
1153 double get textScaleFactor => ui.window.textScaleFactor; 1153 double get textScaleFactor => ui.window.textScaleFactor;
1154 1154
1155 /// give access to TextTheme.of(context) 1155 /// give access to TextTheme.of(context)
1156 - TextTheme get textTheme => theme?.textTheme; 1156 + TextTheme? get textTheme => theme?.textTheme;
1157 1157
1158 /// give access to Mediaquery.of(context) 1158 /// give access to Mediaquery.of(context)
1159 - MediaQueryData get mediaQuery => MediaQuery.of(context); 1159 + MediaQueryData get mediaQuery => MediaQuery.of(context!);
1160 1160
1161 /// Check if dark mode theme is enable 1161 /// Check if dark mode theme is enable
1162 - bool get isDarkMode => (theme.brightness == Brightness.dark); 1162 + bool get isDarkMode => (theme!.brightness == Brightness.dark);
1163 1163
1164 /// Check if dark mode theme is enable on platform on android Q+ 1164 /// Check if dark mode theme is enable on platform on android Q+
1165 bool get isPlatformDarkMode => 1165 bool get isPlatformDarkMode =>
1166 (ui.window.platformBrightness == Brightness.dark); 1166 (ui.window.platformBrightness == Brightness.dark);
1167 1167
1168 /// give access to Theme.of(context).iconTheme.color 1168 /// give access to Theme.of(context).iconTheme.color
1169 - Color get iconColor => theme?.iconTheme?.color; 1169 + Color? get iconColor => theme?.iconTheme?.color;
1170 1170
1171 /// give access to FocusScope.of(context) 1171 /// give access to FocusScope.of(context)
1172 - FocusNode get focusScope => FocusManager.instance.primaryFocus; 1172 + FocusNode? get focusScope => FocusManager.instance.primaryFocus;
1173 1173
1174 // /// give access to Immutable MediaQuery.of(context).size.height 1174 // /// give access to Immutable MediaQuery.of(context).size.height
1175 // double get height => MediaQuery.of(context).size.height; 1175 // double get height => MediaQuery.of(context).size.height;
@@ -1177,16 +1177,16 @@ Since version 2.8 it is possible to access the properties @@ -1177,16 +1177,16 @@ Since version 2.8 it is possible to access the properties
1177 // /// give access to Immutable MediaQuery.of(context).size.width 1177 // /// give access to Immutable MediaQuery.of(context).size.width
1178 // double get width => MediaQuery.of(context).size.width; 1178 // double get width => MediaQuery.of(context).size.width;
1179 1179
1180 - GlobalKey<NavigatorState> get key => getxController?.key; 1180 + GlobalKey<NavigatorState>? get key => getxController.key;
1181 1181
1182 - Map<int, GlobalKey<NavigatorState>> get keys => getxController?.keys; 1182 + Map<int, GlobalKey<NavigatorState>> get keys => getxController.keys;
1183 1183
1184 GetMaterialController get rootController => getxController; 1184 GetMaterialController get rootController => getxController;
1185 1185
1186 bool get defaultPopGesture => getxController.defaultPopGesture; 1186 bool get defaultPopGesture => getxController.defaultPopGesture;
1187 bool get defaultOpaqueRoute => getxController.defaultOpaqueRoute; 1187 bool get defaultOpaqueRoute => getxController.defaultOpaqueRoute;
1188 1188
1189 - Transition get defaultTransition => getxController.defaultTransition; 1189 + Transition? get defaultTransition => getxController.defaultTransition;
1190 1190
1191 Duration get defaultTransitionDuration { 1191 Duration get defaultTransitionDuration {
1192 return getxController.defaultTransitionDuration; 1192 return getxController.defaultTransitionDuration;
@@ -1204,15 +1204,15 @@ Since version 2.8 it is possible to access the properties @@ -1204,15 +1204,15 @@ Since version 2.8 it is possible to access the properties
1204 1204
1205 Routing get routing => getxController.routing; 1205 Routing get routing => getxController.routing;
1206 1206
1207 - Map<String, String> get parameters => getxController.parameters;  
1208 - set parameters(Map<String, String> newParameters) => 1207 + Map<String?, String> get parameters => getxController.parameters;
  1208 + set parameters(Map<String?, String> newParameters) =>
1209 getxController.parameters = newParameters; 1209 getxController.parameters = newParameters;
1210 1210
1211 ParseRouteTree get routeTree => getxController.routeTree; 1211 ParseRouteTree get routeTree => getxController.routeTree;
1212 set routeTree(ParseRouteTree tree) => getxController.routeTree = tree; 1212 set routeTree(ParseRouteTree tree) => getxController.routeTree = tree;
1213 1213
1214 - CustomTransition get customTransition => getxController.customTransition;  
1215 - set customTransition(CustomTransition newTransition) => 1214 + CustomTransition? get customTransition => getxController.customTransition;
  1215 + set customTransition(CustomTransition? newTransition) =>
1216 getxController.customTransition = newTransition; 1216 getxController.customTransition = newTransition;
1217 1217
1218 bool get testMode => getxController.testMode; 1218 bool get testMode => getxController.testMode;
@@ -1224,4 +1224,4 @@ Since version 2.8 it is possible to access the properties @@ -1224,4 +1224,4 @@ Since version 2.8 it is possible to access the properties
1224 /// It replaces the Flutter Navigator, but needs no context. 1224 /// It replaces the Flutter Navigator, but needs no context.
1225 /// You can to use navigator.push(YourRoute()) rather 1225 /// You can to use navigator.push(YourRoute()) rather
1226 /// Navigator.push(context, YourRoute()); 1226 /// Navigator.push(context, YourRoute());
1227 -NavigatorState get navigator => GetNavigation(Get).key.currentState; 1227 +NavigatorState? get navigator => GetNavigation(Get).key!.currentState;
@@ -10,16 +10,16 @@ import 'root_controller.dart'; @@ -10,16 +10,16 @@ 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 = const <String, WidgetBuilder>{},
18 this.initialRoute, 18 this.initialRoute,
19 this.onGenerateRoute, 19 this.onGenerateRoute,
20 this.onGenerateInitialRoutes, 20 this.onGenerateInitialRoutes,
21 this.onUnknownRoute, 21 this.onUnknownRoute,
22 - this.navigatorObservers = const <NavigatorObserver>[], 22 + List<NavigatorObserver> this.navigatorObservers = const <NavigatorObserver>[],
23 this.builder, 23 this.builder,
24 this.translationsKeys, 24 this.translationsKeys,
25 this.translations, 25 this.translations,
@@ -72,64 +72,64 @@ class GetCupertinoApp extends StatelessWidget { @@ -72,64 +72,64 @@ class GetCupertinoApp extends StatelessWidget {
72 backButtonDispatcher = null, 72 backButtonDispatcher = null,
73 super(key: key); 73 super(key: key);
74 74
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; 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;
84 final String title; 84 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; 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;
96 final Iterable<Locale> supportedLocales; 96 final Iterable<Locale> supportedLocales;
97 final bool showPerformanceOverlay; 97 final bool showPerformanceOverlay;
98 final bool checkerboardRasterCacheImages; 98 final bool checkerboardRasterCacheImages;
99 final bool checkerboardOffscreenLayers; 99 final bool checkerboardOffscreenLayers;
100 final bool showSemanticsDebugger; 100 final bool showSemanticsDebugger;
101 final bool debugShowCheckedModeBanner; 101 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; 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;
115 final SmartManagement smartManagement; 115 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; 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;
126 126
127 const GetCupertinoApp.router({ 127 const GetCupertinoApp.router({
128 - Key key, 128 + Key? key,
129 this.theme, 129 this.theme,
130 this.routeInformationProvider, 130 this.routeInformationProvider,
131 - @required this.routeInformationParser,  
132 - @required this.routerDelegate, 131 + required RouteInformationParser<Object> this.routeInformationParser,
  132 + required RouterDelegate<Object> this.routerDelegate,
133 this.backButtonDispatcher, 133 this.backButtonDispatcher,
134 this.builder, 134 this.builder,
135 this.title = '', 135 this.title = '',
@@ -201,7 +201,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -201,7 +201,7 @@ class GetCupertinoApp extends StatelessWidget {
201 onDispose?.call(); 201 onDispose?.call();
202 }, 202 },
203 initState: (i) { 203 initState: (i) {
204 - Get.engine.addPostFrameCallback((timeStamp) { 204 + Get.engine!.addPostFrameCallback((timeStamp) {
205 onReady?.call(); 205 onReady?.call();
206 }); 206 });
207 if (locale != null) Get.locale = locale; 207 if (locale != null) Get.locale = locale;
@@ -209,9 +209,9 @@ class GetCupertinoApp extends StatelessWidget { @@ -209,9 +209,9 @@ class GetCupertinoApp extends StatelessWidget {
209 if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale; 209 if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale;
210 210
211 if (translations != null) { 211 if (translations != null) {
212 - Get.addTranslations(translations.keys); 212 + Get.addTranslations(translations!.keys);
213 } else if (translationsKeys != null) { 213 } else if (translationsKeys != null) {
214 - Get.addTranslations(translationsKeys); 214 + Get.addTranslations(translationsKeys!);
215 } 215 }
216 216
217 Get.customTransition = customTransition; 217 Get.customTransition = customTransition;
@@ -233,8 +233,8 @@ class GetCupertinoApp extends StatelessWidget { @@ -233,8 +233,8 @@ class GetCupertinoApp extends StatelessWidget {
233 }, 233 },
234 builder: (_) => routerDelegate != null 234 builder: (_) => routerDelegate != null
235 ? CupertinoApp.router( 235 ? CupertinoApp.router(
236 - routerDelegate: routerDelegate,  
237 - routeInformationParser: routeInformationParser, 236 + routerDelegate: routerDelegate!,
  237 + routeInformationParser: routeInformationParser!,
238 backButtonDispatcher: backButtonDispatcher, 238 backButtonDispatcher: backButtonDispatcher,
239 routeInformationProvider: routeInformationProvider, 239 routeInformationProvider: routeInformationProvider,
240 key: _.unikey, 240 key: _.unikey,
@@ -245,7 +245,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -245,7 +245,7 @@ class GetCupertinoApp extends StatelessWidget {
245 (rtlLanguages.contains(Get.locale?.languageCode) 245 (rtlLanguages.contains(Get.locale?.languageCode)
246 ? TextDirection.rtl 246 ? TextDirection.rtl
247 : TextDirection.ltr), 247 : TextDirection.ltr),
248 - child: builder == null ? child : builder(context, child), 248 + child: builder == null ? child! : builder!(context, child),
249 ); 249 );
250 }, 250 },
251 title: title ?? '', 251 title: title ?? '',
@@ -285,14 +285,14 @@ class GetCupertinoApp extends StatelessWidget { @@ -285,14 +285,14 @@ class GetCupertinoApp extends StatelessWidget {
285 : <NavigatorObserver>[ 285 : <NavigatorObserver>[
286 GetObserver(routingCallback, Get.routing) 286 GetObserver(routingCallback, Get.routing)
287 ] 287 ]
288 - ..addAll(navigatorObservers)), 288 + ..addAll(navigatorObservers!)),
289 builder: (context, child) { 289 builder: (context, child) {
290 return Directionality( 290 return Directionality(
291 textDirection: textDirection ?? 291 textDirection: textDirection ??
292 (rtlLanguages.contains(Get.locale?.languageCode) 292 (rtlLanguages.contains(Get.locale?.languageCode)
293 ? TextDirection.rtl 293 ? TextDirection.rtl
294 : TextDirection.ltr), 294 : TextDirection.ltr),
295 - child: builder == null ? child : builder(context, child), 295 + child: builder == null ? child! : builder!(context, child),
296 ); 296 );
297 }, 297 },
298 title: title ?? '', 298 title: title ?? '',
@@ -10,15 +10,15 @@ import 'root_controller.dart'; @@ -10,15 +10,15 @@ 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 = const <String, WidgetBuilder>{},
17 this.initialRoute, 17 this.initialRoute,
18 this.onGenerateRoute, 18 this.onGenerateRoute,
19 this.onGenerateInitialRoutes, 19 this.onGenerateInitialRoutes,
20 this.onUnknownRoute, 20 this.onUnknownRoute,
21 - this.navigatorObservers = const <NavigatorObserver>[], 21 + List<NavigatorObserver> this.navigatorObservers = const <NavigatorObserver>[],
22 this.builder, 22 this.builder,
23 this.textDirection, 23 this.textDirection,
24 this.title = '', 24 this.title = '',
@@ -76,66 +76,66 @@ class GetMaterialApp extends StatelessWidget { @@ -76,66 +76,66 @@ class GetMaterialApp extends StatelessWidget {
76 backButtonDispatcher = null, 76 backButtonDispatcher = null,
77 super(key: key); 77 super(key: key);
78 78
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; 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;
88 final String title; 88 final String title;
89 - final GenerateAppTitle onGenerateTitle;  
90 - final ThemeData theme;  
91 - final ThemeData darkTheme; 89 + final GenerateAppTitle? onGenerateTitle;
  90 + final ThemeData? theme;
  91 + final ThemeData? darkTheme;
92 final ThemeMode themeMode; 92 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; 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;
103 final Iterable<Locale> supportedLocales; 103 final Iterable<Locale> supportedLocales;
104 final bool showPerformanceOverlay; 104 final bool showPerformanceOverlay;
105 final bool checkerboardRasterCacheImages; 105 final bool checkerboardRasterCacheImages;
106 final bool checkerboardOffscreenLayers; 106 final bool checkerboardOffscreenLayers;
107 final bool showSemanticsDebugger; 107 final bool showSemanticsDebugger;
108 final bool debugShowCheckedModeBanner; 108 final bool debugShowCheckedModeBanner;
109 - final Map<LogicalKeySet, Intent> shortcuts;  
110 - final ThemeData highContrastTheme;  
111 - final ThemeData highContrastDarkTheme;  
112 - final Map<Type, Action<Intent>> actions; 109 + final Map<LogicalKeySet, Intent>? shortcuts;
  110 + final ThemeData? highContrastTheme;
  111 + final ThemeData? highContrastDarkTheme;
  112 + final Map<Type, Action<Intent>>? actions;
113 final bool debugShowMaterialGrid; 113 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; 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;
123 final SmartManagement smartManagement; 123 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; 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;
133 133
134 const GetMaterialApp.router({ 134 const GetMaterialApp.router({
135 - Key key, 135 + Key? key,
136 this.routeInformationProvider, 136 this.routeInformationProvider,
137 - @required this.routeInformationParser,  
138 - @required this.routerDelegate, 137 + required RouteInformationParser<Object> this.routeInformationParser,
  138 + required RouterDelegate<Object> this.routerDelegate,
139 this.backButtonDispatcher, 139 this.backButtonDispatcher,
140 this.builder, 140 this.builder,
141 this.title = '', 141 this.title = '',
@@ -211,7 +211,7 @@ class GetMaterialApp extends StatelessWidget { @@ -211,7 +211,7 @@ class GetMaterialApp extends StatelessWidget {
211 onDispose?.call(); 211 onDispose?.call();
212 }, 212 },
213 initState: (i) { 213 initState: (i) {
214 - Get.engine.addPostFrameCallback((timeStamp) { 214 + Get.engine!.addPostFrameCallback((timeStamp) {
215 onReady?.call(); 215 onReady?.call();
216 }); 216 });
217 if (locale != null) Get.locale = locale; 217 if (locale != null) Get.locale = locale;
@@ -219,9 +219,9 @@ class GetMaterialApp extends StatelessWidget { @@ -219,9 +219,9 @@ class GetMaterialApp extends StatelessWidget {
219 if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale; 219 if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale;
220 220
221 if (translations != null) { 221 if (translations != null) {
222 - Get.addTranslations(translations.keys); 222 + Get.addTranslations(translations!.keys);
223 } else if (translationsKeys != null) { 223 } else if (translationsKeys != null) {
224 - Get.addTranslations(translationsKeys); 224 + Get.addTranslations(translationsKeys!);
225 } 225 }
226 226
227 Get.customTransition = customTransition; 227 Get.customTransition = customTransition;
@@ -243,8 +243,8 @@ class GetMaterialApp extends StatelessWidget { @@ -243,8 +243,8 @@ class GetMaterialApp extends StatelessWidget {
243 }, 243 },
244 builder: (_) => routerDelegate != null 244 builder: (_) => routerDelegate != null
245 ? MaterialApp.router( 245 ? MaterialApp.router(
246 - routerDelegate: routerDelegate,  
247 - routeInformationParser: routeInformationParser, 246 + routerDelegate: routerDelegate!,
  247 + routeInformationParser: routeInformationParser!,
248 backButtonDispatcher: backButtonDispatcher, 248 backButtonDispatcher: backButtonDispatcher,
249 routeInformationProvider: routeInformationProvider, 249 routeInformationProvider: routeInformationProvider,
250 key: _.unikey, 250 key: _.unikey,
@@ -254,7 +254,7 @@ class GetMaterialApp extends StatelessWidget { @@ -254,7 +254,7 @@ class GetMaterialApp extends StatelessWidget {
254 (rtlLanguages.contains(Get.locale?.languageCode) 254 (rtlLanguages.contains(Get.locale?.languageCode)
255 ? TextDirection.rtl 255 ? TextDirection.rtl
256 : TextDirection.ltr), 256 : TextDirection.ltr),
257 - child: builder == null ? child : builder(context, child), 257 + child: builder == null ? child! : builder!(context, child),
258 ); 258 );
259 }, 259 },
260 title: title ?? '', 260 title: title ?? '',
@@ -297,14 +297,14 @@ class GetMaterialApp extends StatelessWidget { @@ -297,14 +297,14 @@ class GetMaterialApp extends StatelessWidget {
297 : <NavigatorObserver>[ 297 : <NavigatorObserver>[
298 GetObserver(routingCallback, Get.routing) 298 GetObserver(routingCallback, Get.routing)
299 ] 299 ]
300 - ..addAll(navigatorObservers)), 300 + ..addAll(navigatorObservers!)),
301 builder: (context, child) { 301 builder: (context, child) {
302 return Directionality( 302 return Directionality(
303 textDirection: textDirection ?? 303 textDirection: textDirection ??
304 (rtlLanguages.contains(Get.locale?.languageCode) 304 (rtlLanguages.contains(Get.locale?.languageCode)
305 ? TextDirection.rtl 305 ? TextDirection.rtl
306 : TextDirection.ltr), 306 : TextDirection.ltr),
307 - child: builder == null ? child : builder(context, child), 307 + child: builder == null ? child! : builder!(context, child),
308 ); 308 );
309 }, 309 },
310 title: title ?? '', 310 title: title ?? '',
@@ -2,10 +2,11 @@ import '../../../get_core/src/get_main.dart'; @@ -2,10 +2,11 @@ import '../../../get_core/src/get_main.dart';
2 2
3 import '../../get_navigation.dart'; 3 import '../../get_navigation.dart';
4 import '../routes/get_route.dart'; 4 import '../routes/get_route.dart';
  5 +import 'package:collection/collection.dart' show IterableExtension;
5 6
6 class RouteDecoder { 7 class RouteDecoder {
7 - final GetPage route;  
8 - final Map<String, String> parameters; 8 + final GetPage? route;
  9 + final Map<String?, String> parameters;
9 const RouteDecoder(this.route, this.parameters); 10 const RouteDecoder(this.route, this.parameters);
10 } 11 }
11 12
@@ -15,7 +16,7 @@ class ParseRouteTree { @@ -15,7 +16,7 @@ class ParseRouteTree {
15 RouteDecoder matchRoute(String name) { 16 RouteDecoder matchRoute(String name) {
16 final uri = Uri.parse(name); 17 final uri = Uri.parse(name);
17 final route = _findRoute(uri.path); 18 final route = _findRoute(uri.path);
18 - final params = Map<String, String>.from(uri.queryParameters); 19 + final params = Map<String?, String>.from(uri.queryParameters);
19 if (route != null) { 20 if (route != null) {
20 final parsedParams = _parseParams(name, route.path); 21 final parsedParams = _parseParams(name, route.path);
21 if (parsedParams != null && parsedParams.isNotEmpty) { 22 if (parsedParams != null && parsedParams.isNotEmpty) {
@@ -45,12 +46,12 @@ class ParseRouteTree { @@ -45,12 +46,12 @@ class ParseRouteTree {
45 46
46 List<GetPage> _flattenPage(GetPage route) { 47 List<GetPage> _flattenPage(GetPage route) {
47 final result = <GetPage>[]; 48 final result = <GetPage>[];
48 - if (route.children == null || route.children.isEmpty) { 49 + if (route.children == null || route.children!.isEmpty) {
49 return result; 50 return result;
50 } 51 }
51 52
52 final parentPath = route.name; 53 final parentPath = route.name;
53 - for (var page in route.children) { 54 + for (var page in route.children!) {
54 // Add Parent middlewares to children 55 // Add Parent middlewares to children
55 final pageMiddlewares = page.middlewares ?? <GetMiddleware>[]; 56 final pageMiddlewares = page.middlewares ?? <GetMiddleware>[];
56 pageMiddlewares.addAll(route.middlewares ?? <GetMiddleware>[]); 57 pageMiddlewares.addAll(route.middlewares ?? <GetMiddleware>[]);
@@ -88,19 +89,18 @@ class ParseRouteTree { @@ -88,19 +89,18 @@ class ParseRouteTree {
88 middlewares: middlewares, 89 middlewares: middlewares,
89 ); 90 );
90 91
91 - GetPage _findRoute(String name) {  
92 - return _routes.firstWhere( 92 + GetPage? _findRoute(String name) {
  93 + return _routes.firstWhereOrNull(
93 (route) => route.path.regex.hasMatch(name), 94 (route) => route.path.regex.hasMatch(name),
94 - orElse: () => null,  
95 ); 95 );
96 } 96 }
97 97
98 - Map<String, String> _parseParams(String path, PathDecoded routePath) {  
99 - final params = <String, String>{};  
100 - Match paramsMatch = routePath.regex.firstMatch(path); 98 + Map<String?, String> _parseParams(String path, PathDecoded routePath) {
  99 + final params = <String?, String>{};
  100 + Match? paramsMatch = routePath.regex.firstMatch(path);
101 101
102 for (var i = 0; i < routePath.keys.length; i++) { 102 for (var i = 0; i < routePath.keys.length; i++) {
103 - var param = Uri.decodeQueryComponent(paramsMatch[i + 1]); 103 + var param = Uri.decodeQueryComponent(paramsMatch![i + 1]!);
104 params[routePath.keys[i]] = param; 104 params[routePath.keys[i]] = param;
105 } 105 }
106 return params; 106 return params;
@@ -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 + 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,
@@ -41,41 +41,41 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -41,41 +41,41 @@ class GetPageRoute<T> extends PageRoute<T> {
41 @override 41 @override
42 final Duration transitionDuration; 42 final Duration transitionDuration;
43 43
44 - final GetPageBuilder page; 44 + final GetPageBuilder? page;
45 45
46 - final String routeName; 46 + final String? routeName;
47 47
48 final String reference; 48 final String reference;
49 49
50 - final CustomTransition customTransition; 50 + final CustomTransition? customTransition;
51 51
52 - final Bindings binding; 52 + final Bindings? binding;
53 53
54 - final Map<String, String> parameter; 54 + final Map<String, String>? parameter;
55 55
56 - final List<Bindings> bindings; 56 + final List<Bindings>? bindings;
57 57
58 @override 58 @override
59 final bool opaque; 59 final bool opaque;
60 60
61 - final bool popGesture; 61 + final bool? popGesture;
62 62
63 @override 63 @override
64 final bool barrierDismissible; 64 final bool barrierDismissible;
65 65
66 - final Transition transition; 66 + final Transition? transition;
67 67
68 - final Curve curve; 68 + final Curve? curve;
69 69
70 - final Alignment alignment; 70 + final Alignment? alignment;
71 71
72 - final List<GetMiddleware> middlewares; 72 + final List<GetMiddleware>? middlewares;
73 73
74 @override 74 @override
75 - final Color barrierColor; 75 + final Color? barrierColor;
76 76
77 @override 77 @override
78 - final String barrierLabel; 78 + final String? barrierLabel;
79 79
80 @override 80 @override
81 final bool maintainState; 81 final bool maintainState;
@@ -93,8 +93,8 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -93,8 +93,8 @@ class GetPageRoute<T> extends PageRoute<T> {
93 route.willHandlePopInternally || 93 route.willHandlePopInternally ||
94 route.hasScopedWillPopCallback || 94 route.hasScopedWillPopCallback ||
95 route.fullscreenDialog || 95 route.fullscreenDialog ||
96 - route.animation.status != AnimationStatus.completed ||  
97 - route.secondaryAnimation.status != AnimationStatus.dismissed || 96 + route.animation!.status != AnimationStatus.completed ||
  97 + route.secondaryAnimation!.status != AnimationStatus.dismissed ||
98 isPopGestureInProgress(route)) return false; 98 isPopGestureInProgress(route)) return false;
99 99
100 return true; 100 return true;
@@ -105,8 +105,8 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -105,8 +105,8 @@ class GetPageRoute<T> extends PageRoute<T> {
105 assert(_isPopGestureEnabled(route)); 105 assert(_isPopGestureEnabled(route));
106 106
107 return _CupertinoBackGestureController<T>( 107 return _CupertinoBackGestureController<T>(
108 - navigator: route.navigator,  
109 - controller: route.controller, 108 + navigator: route.navigator!,
  109 + controller: route.controller!,
110 ); 110 );
111 } 111 }
112 112
@@ -129,12 +129,12 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -129,12 +129,12 @@ class GetPageRoute<T> extends PageRoute<T> {
129 } 129 }
130 } 130 }
131 131
132 - final pageToBuild = middlewareRunner.runOnPageBuildStart(page); 132 + final pageToBuild = middlewareRunner.runOnPageBuildStart(page)!;
133 return middlewareRunner.runOnPageBuilt(pageToBuild()); 133 return middlewareRunner.runOnPageBuilt(pageToBuild());
134 } 134 }
135 135
136 static bool isPopGestureInProgress(PageRoute<dynamic> route) { 136 static bool isPopGestureInProgress(PageRoute<dynamic> route) {
137 - return route.navigator.userGestureInProgress; 137 + return route.navigator!.userGestureInProgress;
138 } 138 }
139 139
140 bool get popGestureInProgress => isPopGestureInProgress(this); 140 bool get popGestureInProgress => isPopGestureInProgress(this);
@@ -156,7 +156,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -156,7 +156,7 @@ class GetPageRoute<T> extends PageRoute<T> {
156 linearTransition: hasCurve); 156 linearTransition: hasCurve);
157 } 157 }
158 if (customTransition != null) { 158 if (customTransition != null) {
159 - return customTransition.buildTransition( 159 + return customTransition!.buildTransition(
160 context, 160 context,
161 finalCurve, 161 finalCurve,
162 alignment, 162 alignment,
@@ -312,7 +312,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -312,7 +312,7 @@ class GetPageRoute<T> extends PageRoute<T> {
312 case Transition.size: 312 case Transition.size:
313 return SizeTransitions().buildTransitions( 313 return SizeTransitions().buildTransitions(
314 context, 314 context,
315 - curve, 315 + curve!,
316 alignment, 316 alignment,
317 animation, 317 animation,
318 secondaryAnimation, 318 secondaryAnimation,
@@ -364,7 +364,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -364,7 +364,7 @@ class GetPageRoute<T> extends PageRoute<T> {
364 364
365 default: 365 default:
366 if (Get.customTransition != null) { 366 if (Get.customTransition != null) {
367 - return Get.customTransition.buildTransition( 367 + return Get.customTransition!.buildTransition(
368 context, curve, alignment, animation, secondaryAnimation, child); 368 context, curve, alignment, animation, secondaryAnimation, child);
369 } 369 }
370 370
@@ -386,7 +386,7 @@ class GetPageRoute<T> extends PageRoute<T> { @@ -386,7 +386,7 @@ class GetPageRoute<T> extends PageRoute<T> {
386 void dispose() { 386 void dispose() {
387 super.dispose(); 387 super.dispose();
388 if (Get.smartManagement != SmartManagement.onlyBuilder) { 388 if (Get.smartManagement != SmartManagement.onlyBuilder) {
389 - WidgetsBinding.instance.addPostFrameCallback((_) { 389 + WidgetsBinding.instance!.addPostFrameCallback((_) {
390 if (Get.reference != reference) { 390 if (Get.reference != reference) {
391 GetInstance().removeDependencyByRoute("$reference"); 391 GetInstance().removeDependencyByRoute("$reference");
392 } 392 }
@@ -412,10 +412,10 @@ const int _kMaxPageBackAnimationTime = 300; @@ -412,10 +412,10 @@ const int _kMaxPageBackAnimationTime = 300;
412 412
413 class _CupertinoBackGestureDetector<T> extends StatefulWidget { 413 class _CupertinoBackGestureDetector<T> extends StatefulWidget {
414 const _CupertinoBackGestureDetector({ 414 const _CupertinoBackGestureDetector({
415 - Key key,  
416 - @required this.enabledCallback,  
417 - @required this.onStartPopGesture,  
418 - @required this.child, 415 + Key? key,
  416 + required this.enabledCallback,
  417 + required this.onStartPopGesture,
  418 + required this.child,
419 }) : assert(enabledCallback != null), 419 }) : assert(enabledCallback != null),
420 assert(onStartPopGesture != null), 420 assert(onStartPopGesture != null),
421 assert(child != null), 421 assert(child != null),
@@ -434,9 +434,9 @@ class _CupertinoBackGestureDetector<T> extends StatefulWidget { @@ -434,9 +434,9 @@ class _CupertinoBackGestureDetector<T> extends StatefulWidget {
434 434
435 class _CupertinoBackGestureDetectorState<T> 435 class _CupertinoBackGestureDetectorState<T>
436 extends State<_CupertinoBackGestureDetector<T>> { 436 extends State<_CupertinoBackGestureDetector<T>> {
437 - _CupertinoBackGestureController<T> _backGestureController; 437 + _CupertinoBackGestureController<T>? _backGestureController;
438 438
439 - HorizontalDragGestureRecognizer _recognizer; 439 + late HorizontalDragGestureRecognizer _recognizer;
440 440
441 @override 441 @override
442 void initState() { 442 void initState() {
@@ -463,15 +463,15 @@ class _CupertinoBackGestureDetectorState<T> @@ -463,15 +463,15 @@ class _CupertinoBackGestureDetectorState<T>
463 void _handleDragUpdate(DragUpdateDetails details) { 463 void _handleDragUpdate(DragUpdateDetails details) {
464 assert(mounted); 464 assert(mounted);
465 assert(_backGestureController != null); 465 assert(_backGestureController != null);
466 - _backGestureController.dragUpdate(  
467 - _convertToLogical(details.primaryDelta / context.size.width)); 466 + _backGestureController!.dragUpdate(
  467 + _convertToLogical(details.primaryDelta! / context.size!.width)!);
468 } 468 }
469 469
470 void _handleDragEnd(DragEndDetails details) { 470 void _handleDragEnd(DragEndDetails details) {
471 assert(mounted); 471 assert(mounted);
472 assert(_backGestureController != null); 472 assert(_backGestureController != null);
473 - _backGestureController.dragEnd(_convertToLogical(  
474 - details.velocity.pixelsPerSecond.dx / context.size.width)); 473 + _backGestureController!.dragEnd(_convertToLogical(
  474 + details.velocity.pixelsPerSecond.dx / context.size!.width)!);
475 _backGestureController = null; 475 _backGestureController = null;
476 } 476 }
477 477
@@ -487,7 +487,7 @@ class _CupertinoBackGestureDetectorState<T> @@ -487,7 +487,7 @@ class _CupertinoBackGestureDetectorState<T>
487 if (widget.enabledCallback()) _recognizer.addPointer(event); 487 if (widget.enabledCallback()) _recognizer.addPointer(event);
488 } 488 }
489 489
490 - double _convertToLogical(double value) { 490 + double? _convertToLogical(double value) {
491 switch (Directionality.of(context)) { 491 switch (Directionality.of(context)) {
492 case TextDirection.rtl: 492 case TextDirection.rtl:
493 return -value; 493 return -value;
@@ -533,8 +533,8 @@ class _CupertinoBackGestureController<T> { @@ -533,8 +533,8 @@ class _CupertinoBackGestureController<T> {
533 /// 533 ///
534 /// The [navigator] and [controller] arguments must not be null. 534 /// The [navigator] and [controller] arguments must not be null.
535 _CupertinoBackGestureController({ 535 _CupertinoBackGestureController({
536 - @required this.navigator,  
537 - @required this.controller, 536 + required this.navigator,
  537 + required this.controller,
538 }) : assert(navigator != null), 538 }) : assert(navigator != null),
539 assert(controller != null) { 539 assert(controller != null) {
540 navigator.didStartUserGesture(); 540 navigator.didStartUserGesture();
@@ -579,7 +579,7 @@ class _CupertinoBackGestureController<T> { @@ -579,7 +579,7 @@ class _CupertinoBackGestureController<T> {
579 _kMaxDroppedSwipePageForwardAnimationTime, 579 _kMaxDroppedSwipePageForwardAnimationTime,
580 0, 580 0,
581 controller.value, 581 controller.value,
582 - ).floor(), 582 + )!.floor(),
583 _kMaxPageBackAnimationTime, 583 _kMaxPageBackAnimationTime,
584 ); 584 );
585 controller.animateTo(1.0, 585 controller.animateTo(1.0,
@@ -597,7 +597,7 @@ class _CupertinoBackGestureController<T> { @@ -597,7 +597,7 @@ class _CupertinoBackGestureController<T> {
597 0, 597 0,
598 _kMaxDroppedSwipePageForwardAnimationTime, 598 _kMaxDroppedSwipePageForwardAnimationTime,
599 controller.value, 599 controller.value,
600 - ).floor(); 600 + )!.floor();
601 controller.animateBack( 601 controller.animateBack(
602 0.0, 602 0.0,
603 duration: Duration(milliseconds: droppedPageBackAnimationTime), 603 duration: Duration(milliseconds: droppedPageBackAnimationTime),
@@ -610,7 +610,7 @@ class _CupertinoBackGestureController<T> { @@ -610,7 +610,7 @@ class _CupertinoBackGestureController<T> {
610 // Keep the userGestureInProgress in true state so we don't change the 610 // Keep the userGestureInProgress in true state so we don't change the
611 // curve of the page transition mid-flight since CupertinoPageTransition 611 // curve of the page transition mid-flight since CupertinoPageTransition
612 // depends on userGestureInProgress. 612 // depends on userGestureInProgress.
613 - AnimationStatusListener animationStatusCallback; 613 + late AnimationStatusListener animationStatusCallback;
614 animationStatusCallback = (status) { 614 animationStatusCallback = (status) {
615 navigator.didStopUserGesture(); 615 navigator.didStopUserGesture();
616 controller.removeStatusListener(animationStatusCallback); 616 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,
@@ -58,7 +58,7 @@ class GetPage { @@ -58,7 +58,7 @@ class GetPage {
58 assert(fullscreenDialog != null); 58 assert(fullscreenDialog != null);
59 59
60 static PathDecoded _nameToRegex(String path) { 60 static PathDecoded _nameToRegex(String path) {
61 - var keys = <String>[]; 61 + var keys = <String?>[];
62 62
63 String _replace(Match pattern) { 63 String _replace(Match pattern) {
64 var buffer = StringBuffer('(?:'); 64 var buffer = StringBuffer('(?:');
@@ -79,24 +79,24 @@ class GetPage { @@ -79,24 +79,24 @@ class GetPage {
79 } 79 }
80 80
81 GetPage copyWith({ 81 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, 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,
100 }) { 100 }) {
101 return GetPage( 101 return GetPage(
102 name: name ?? this.name, 102 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) { 38 +String? _extractRouteName(Route? route) {
39 if (route?.settings?.name != null) { 39 if (route?.settings?.name != null) {
40 - return route.settings.name; 40 + return route!.settings.name;
41 } 41 }
42 42
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
@@ -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);
@@ -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);
@@ -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);
@@ -16,7 +16,7 @@ abstract class _RouteMiddleware { @@ -16,7 +16,7 @@ abstract class _RouteMiddleware {
16 /// ``` 16 /// ```
17 /// -8 => 2 => 4 => 5 17 /// -8 => 2 => 4 => 5
18 /// {@end-tool} 18 /// {@end-tool}
19 - int priority; 19 + int? priority;
20 20
21 /// This function will be called when the page of 21 /// This function will be called when the page of
22 /// the called route is being searched for. 22 /// the called route is being searched for.
@@ -30,7 +30,7 @@ abstract class _RouteMiddleware { @@ -30,7 +30,7 @@ abstract class _RouteMiddleware {
30 /// } 30 /// }
31 /// ``` 31 /// ```
32 /// {@end-tool} 32 /// {@end-tool}
33 - RouteSettings redirect(String route); 33 + RouteSettings? redirect(String route);
34 34
35 /// This function will be called when this Page is called 35 /// This function will be called when this Page is called
36 /// you can use it to change something about the page or give it new page 36 /// you can use it to change something about the page or give it new page
@@ -42,7 +42,7 @@ abstract class _RouteMiddleware { @@ -42,7 +42,7 @@ abstract class _RouteMiddleware {
42 /// } 42 /// }
43 /// ``` 43 /// ```
44 /// {@end-tool} 44 /// {@end-tool}
45 - GetPage onPageCalled(GetPage page); 45 + GetPage? onPageCalled(GetPage page);
46 46
47 /// This function will be called right before the [Bindings] are initialize. 47 /// This function will be called right before the [Bindings] are initialize.
48 /// Here you can change [Bindings] for this page 48 /// Here you can change [Bindings] for this page
@@ -57,10 +57,10 @@ abstract class _RouteMiddleware { @@ -57,10 +57,10 @@ abstract class _RouteMiddleware {
57 /// } 57 /// }
58 /// ``` 58 /// ```
59 /// {@end-tool} 59 /// {@end-tool}
60 - List<Bindings> onBindingsStart(List<Bindings> bindings); 60 + List<Bindings>? onBindingsStart(List<Bindings> bindings);
61 61
62 /// This function will be called right after the [Bindings] are initialize. 62 /// This function will be called right after the [Bindings] are initialize.
63 - GetPageBuilder onPageBuildStart(GetPageBuilder page); 63 + GetPageBuilder? onPageBuildStart(GetPageBuilder page);
64 64
65 /// This function will be called right after the 65 /// This function will be called right after the
66 /// GetPage.page function is called and will give you the result 66 /// GetPage.page function is called and will give you the result
@@ -76,21 +76,21 @@ abstract class _RouteMiddleware { @@ -76,21 +76,21 @@ abstract class _RouteMiddleware {
76 /// [onPageBuildStart] -> [onPageBuilt] -> [onPageDispose] )) 76 /// [onPageBuildStart] -> [onPageBuilt] -> [onPageDispose] ))
77 class GetMiddleware implements _RouteMiddleware { 77 class GetMiddleware implements _RouteMiddleware {
78 @override 78 @override
79 - int priority = 0; 79 + int? priority = 0;
80 80
81 GetMiddleware({this.priority}); 81 GetMiddleware({this.priority});
82 82
83 @override 83 @override
84 - RouteSettings redirect(String route) => null; 84 + RouteSettings? redirect(String? route) => null;
85 85
86 @override 86 @override
87 - GetPage onPageCalled(GetPage page) => page; 87 + GetPage? onPageCalled(GetPage? page) => page;
88 88
89 @override 89 @override
90 - List<Bindings> onBindingsStart(List<Bindings> bindings) => bindings; 90 + List<Bindings>? onBindingsStart(List<Bindings>? bindings) => bindings;
91 91
92 @override 92 @override
93 - GetPageBuilder onPageBuildStart(GetPageBuilder page) => page; 93 + GetPageBuilder? onPageBuildStart(GetPageBuilder? page) => page;
94 94
95 @override 95 @override
96 Widget onPageBuilt(Widget page) => page; 96 Widget onPageBuilt(Widget page) => page;
@@ -102,26 +102,26 @@ class GetMiddleware implements _RouteMiddleware { @@ -102,26 +102,26 @@ class GetMiddleware implements _RouteMiddleware {
102 class MiddlewareRunner { 102 class MiddlewareRunner {
103 MiddlewareRunner(this._middlewares); 103 MiddlewareRunner(this._middlewares);
104 104
105 - final List<GetMiddleware> _middlewares; 105 + final List<GetMiddleware>? _middlewares;
106 106
107 - List<GetMiddleware> _getMiddlewares() { 107 + List<GetMiddleware>? _getMiddlewares() {
108 if (_middlewares != null) { 108 if (_middlewares != null) {
109 - _middlewares.sort((a, b) => a.priority.compareTo(b.priority)); 109 + _middlewares!.sort((a, b) => a.priority!.compareTo(b.priority!));
110 return _middlewares; 110 return _middlewares;
111 } 111 }
112 return <GetMiddleware>[]; 112 return <GetMiddleware>[];
113 } 113 }
114 114
115 - GetPage runOnPageCalled(GetPage page) {  
116 - _getMiddlewares().forEach((element) { 115 + GetPage? runOnPageCalled(GetPage? page) {
  116 + _getMiddlewares()!.forEach((element) {
117 page = element.onPageCalled(page); 117 page = element.onPageCalled(page);
118 }); 118 });
119 return page; 119 return page;
120 } 120 }
121 121
122 - RouteSettings runRedirect(String route) {  
123 - RouteSettings to;  
124 - _getMiddlewares().forEach((element) { 122 + RouteSettings? runRedirect(String? route) {
  123 + RouteSettings? to;
  124 + _getMiddlewares()!.forEach((element) {
125 to = element.redirect(route); 125 to = element.redirect(route);
126 }); 126 });
127 if (to != null) { 127 if (to != null) {
@@ -130,34 +130,34 @@ class MiddlewareRunner { @@ -130,34 +130,34 @@ class MiddlewareRunner {
130 return to; 130 return to;
131 } 131 }
132 132
133 - List<Bindings> runOnBindingsStart(List<Bindings> bindings) {  
134 - _getMiddlewares().forEach((element) { 133 + List<Bindings>? runOnBindingsStart(List<Bindings>? bindings) {
  134 + _getMiddlewares()!.forEach((element) {
135 bindings = element.onBindingsStart(bindings); 135 bindings = element.onBindingsStart(bindings);
136 }); 136 });
137 return bindings; 137 return bindings;
138 } 138 }
139 139
140 - GetPageBuilder runOnPageBuildStart(GetPageBuilder page) {  
141 - _getMiddlewares().forEach((element) { 140 + GetPageBuilder? runOnPageBuildStart(GetPageBuilder? page) {
  141 + _getMiddlewares()!.forEach((element) {
142 page = element.onPageBuildStart(page); 142 page = element.onPageBuildStart(page);
143 }); 143 });
144 return page; 144 return page;
145 } 145 }
146 146
147 Widget runOnPageBuilt(Widget page) { 147 Widget runOnPageBuilt(Widget page) {
148 - _getMiddlewares().forEach((element) { 148 + _getMiddlewares()!.forEach((element) {
149 page = element.onPageBuilt(page); 149 page = element.onPageBuilt(page);
150 }); 150 });
151 return page; 151 return page;
152 } 152 }
153 153
154 void runOnPageDispose() => 154 void runOnPageDispose() =>
155 - _getMiddlewares().forEach((element) => element.onPageDispose()); 155 + _getMiddlewares()!.forEach((element) => element.onPageDispose());
156 } 156 }
157 157
158 class PageRedirect { 158 class PageRedirect {
159 - GetPage route;  
160 - GetPage unknownRoute; 159 + GetPage? route;
  160 + GetPage? unknownRoute;
161 RouteSettings settings; 161 RouteSettings settings;
162 bool isUnknown; 162 bool isUnknown;
163 163
@@ -169,43 +169,43 @@ class PageRedirect { @@ -169,43 +169,43 @@ class PageRedirect {
169 while (needRecheck()) {} 169 while (needRecheck()) {}
170 return isUnknown 170 return isUnknown
171 ? GetPageRoute( 171 ? GetPageRoute(
172 - page: unknownRoute.page,  
173 - parameter: unknownRoute.parameter, 172 + page: unknownRoute!.page,
  173 + parameter: unknownRoute!.parameter,
174 settings: RouteSettings( 174 settings: RouteSettings(
175 - name: unknownRoute.name, arguments: settings.arguments),  
176 - curve: unknownRoute.curve,  
177 - opaque: unknownRoute.opaque,  
178 - customTransition: unknownRoute.customTransition,  
179 - binding: unknownRoute.binding,  
180 - bindings: unknownRoute.bindings,  
181 - transitionDuration: (unknownRoute.transitionDuration ?? 175 + name: unknownRoute!.name, arguments: settings.arguments),
  176 + curve: unknownRoute!.curve,
  177 + opaque: unknownRoute!.opaque,
  178 + customTransition: unknownRoute!.customTransition,
  179 + binding: unknownRoute!.binding,
  180 + bindings: unknownRoute!.bindings,
  181 + transitionDuration: (unknownRoute!.transitionDuration ??
182 Get.defaultTransitionDuration), 182 Get.defaultTransitionDuration),
183 - transition: unknownRoute.transition,  
184 - popGesture: unknownRoute.popGesture,  
185 - fullscreenDialog: unknownRoute.fullscreenDialog,  
186 - middlewares: unknownRoute.middlewares, 183 + transition: unknownRoute!.transition,
  184 + popGesture: unknownRoute!.popGesture,
  185 + fullscreenDialog: unknownRoute!.fullscreenDialog,
  186 + middlewares: unknownRoute!.middlewares,
187 ) 187 )
188 : GetPageRoute( 188 : GetPageRoute(
189 - page: route.page,  
190 - parameter: route.parameter, 189 + page: route!.page,
  190 + parameter: route!.parameter,
191 settings: RouteSettings( 191 settings: RouteSettings(
192 name: settings.name, arguments: settings.arguments), 192 name: settings.name, arguments: settings.arguments),
193 - curve: route.curve,  
194 - opaque: route.opaque,  
195 - customTransition: route.customTransition,  
196 - binding: route.binding,  
197 - bindings: route.bindings, 193 + curve: route!.curve,
  194 + opaque: route!.opaque,
  195 + customTransition: route!.customTransition,
  196 + binding: route!.binding,
  197 + bindings: route!.bindings,
198 transitionDuration: 198 transitionDuration:
199 - (route.transitionDuration ?? Get.defaultTransitionDuration),  
200 - transition: route.transition,  
201 - popGesture: route.popGesture,  
202 - fullscreenDialog: route.fullscreenDialog,  
203 - middlewares: route.middlewares); 199 + (route!.transitionDuration ?? Get.defaultTransitionDuration),
  200 + transition: route!.transition,
  201 + popGesture: route!.popGesture,
  202 + fullscreenDialog: route!.fullscreenDialog,
  203 + middlewares: route!.middlewares);
204 } 204 }
205 205
206 /// check if redirect is needed 206 /// check if redirect is needed
207 bool needRecheck() { 207 bool needRecheck() {
208 - final match = Get.routeTree.matchRoute(settings.name); 208 + final match = Get.routeTree!.matchRoute(settings.name!);
209 Get.parameters = match?.parameters; 209 Get.parameters = match?.parameters;
210 210
211 // No Match found 211 // No Match found
@@ -214,12 +214,12 @@ class PageRedirect { @@ -214,12 +214,12 @@ class PageRedirect {
214 return false; 214 return false;
215 } 215 }
216 216
217 - final runner = MiddlewareRunner(match.route.middlewares); 217 + final runner = MiddlewareRunner(match.route!.middlewares);
218 route = runner.runOnPageCalled(match.route); 218 route = runner.runOnPageCalled(match.route);
219 - addPageParameter(route); 219 + addPageParameter(route!);
220 220
221 // No middlewares found return match. 221 // No middlewares found return match.
222 - if (match.route.middlewares == null || match.route.middlewares.isEmpty) { 222 + if (match.route!.middlewares == null || match.route!.middlewares!.isEmpty) {
223 return false; 223 return false;
224 } 224 }
225 final newSettings = runner.runRedirect(settings.name); 225 final newSettings = runner.runRedirect(settings.name);
@@ -234,10 +234,10 @@ class PageRedirect { @@ -234,10 +234,10 @@ class PageRedirect {
234 if (route.parameter == null) return; 234 if (route.parameter == null) return;
235 235
236 if (Get.parameters == null) { 236 if (Get.parameters == null) {
237 - Get.parameters = route.parameter; 237 + Get.parameters = route.parameter!;
238 } else { 238 } else {
239 final parameters = Get.parameters; 239 final parameters = Get.parameters;
240 - parameters.addEntries(route.parameter.entries); 240 + parameters.addEntries(route.parameter!.entries);
241 Get.parameters = parameters; 241 Get.parameters = parameters;
242 } 242 }
243 } 243 }
@@ -5,12 +5,12 @@ import 'package:flutter/scheduler.dart'; @@ -5,12 +5,12 @@ import 'package:flutter/scheduler.dart';
5 import '../../../get_core/get_core.dart'; 5 import '../../../get_core/get_core.dart';
6 import '../../get_navigation.dart'; 6 import '../../get_navigation.dart';
7 7
8 -typedef SnackbarStatusCallback = void Function(SnackbarStatus status); 8 +typedef SnackbarStatusCallback = void Function(SnackbarStatus? status);
9 typedef OnTap = void Function(GetBar snack); 9 typedef OnTap = void Function(GetBar snack);
10 10
11 class GetBar<T extends Object> extends StatefulWidget { 11 class GetBar<T extends Object> extends StatefulWidget {
12 GetBar({ 12 GetBar({
13 - Key key, 13 + Key? key,
14 this.title, 14 this.title,
15 this.message, 15 this.message,
16 this.titleText, 16 this.titleText,
@@ -45,7 +45,7 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -45,7 +45,7 @@ class GetBar<T extends Object> extends StatefulWidget {
45 this.overlayBlur = 0.0, 45 this.overlayBlur = 0.0,
46 this.overlayColor = Colors.transparent, 46 this.overlayColor = Colors.transparent,
47 this.userInputForm, 47 this.userInputForm,
48 - SnackbarStatusCallback snackbarStatus, 48 + SnackbarStatusCallback? snackbarStatus,
49 }) : snackbarStatus = (snackbarStatus ?? (status) {}), 49 }) : snackbarStatus = (snackbarStatus ?? (status) {}),
50 super(key: key); 50 super(key: key);
51 51
@@ -53,18 +53,18 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -53,18 +53,18 @@ class GetBar<T extends Object> extends StatefulWidget {
53 final SnackbarStatusCallback snackbarStatus; 53 final SnackbarStatusCallback snackbarStatus;
54 54
55 /// The title displayed to the user 55 /// The title displayed to the user
56 - final String title; 56 + final String? title;
57 57
58 /// The message displayed to the user. 58 /// The message displayed to the user.
59 - final String message; 59 + final String? message;
60 60
61 /// Replaces [title]. Although this accepts a [Widget], it is meant 61 /// Replaces [title]. Although this accepts a [Widget], it is meant
62 /// to receive [Text] or [RichText] 62 /// to receive [Text] or [RichText]
63 - final Widget titleText; 63 + final Widget? titleText;
64 64
65 /// Replaces [message]. Although this accepts a [Widget], it is meant 65 /// Replaces [message]. Although this accepts a [Widget], it is meant
66 /// to receive [Text] or [RichText] 66 /// to receive [Text] or [RichText]
67 - final Widget messageText; 67 + final Widget? messageText;
68 68
69 /// Will be ignored if [backgroundGradient] is not null 69 /// Will be ignored if [backgroundGradient] is not null
70 final Color backgroundColor; 70 final Color backgroundColor;
@@ -72,48 +72,48 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -72,48 +72,48 @@ class GetBar<T extends Object> extends StatefulWidget {
72 /// If not null, shows a left vertical colored bar on notification. 72 /// If not null, shows a left vertical colored bar on notification.
73 /// It is not possible to use it with a [Form] and I do not recommend 73 /// It is not possible to use it with a [Form] and I do not recommend
74 /// using it with [LinearProgressIndicator] 74 /// using it with [LinearProgressIndicator]
75 - final Color leftBarIndicatorColor; 75 + final Color? leftBarIndicatorColor;
76 76
77 /// [boxShadows] The shadows generated by Snack. Leave it null 77 /// [boxShadows] The shadows generated by Snack. Leave it null
78 /// if you don't want a shadow. 78 /// if you don't want a shadow.
79 /// You can use more than one if you feel the need. 79 /// You can use more than one if you feel the need.
80 /// Check (this example)[https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/shadows.dart] 80 /// Check (this example)[https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/shadows.dart]
81 - final List<BoxShadow> boxShadows; 81 + final List<BoxShadow>? boxShadows;
82 82
83 /// Makes [backgroundColor] be ignored. 83 /// Makes [backgroundColor] be ignored.
84 - final Gradient backgroundGradient; 84 + final Gradient? backgroundGradient;
85 85
86 /// You can use any widget here, but I recommend [Icon] or [Image] as 86 /// You can use any widget here, but I recommend [Icon] or [Image] as
87 /// indication of what kind 87 /// indication of what kind
88 /// of message you are displaying. Other widgets may break the layout 88 /// of message you are displaying. Other widgets may break the layout
89 - final Widget icon; 89 + final Widget? icon;
90 90
91 /// An option to animate the icon (if present). Defaults to true. 91 /// An option to animate the icon (if present). Defaults to true.
92 final bool shouldIconPulse; 92 final bool shouldIconPulse;
93 93
94 /// A [TextButton] widget if you need an action from the user. 94 /// A [TextButton] widget if you need an action from the user.
95 - final Widget mainButton; 95 + final Widget? mainButton;
96 96
97 /// A callback that registers the user's click anywhere. 97 /// A callback that registers the user's click anywhere.
98 /// An alternative to [mainButton] 98 /// An alternative to [mainButton]
99 - final OnTap onTap; 99 + final OnTap? onTap;
100 100
101 /// How long until Snack will hide itself (be dismissed). 101 /// How long until Snack will hide itself (be dismissed).
102 /// To make it indefinite, leave it null. 102 /// To make it indefinite, leave it null.
103 - final Duration duration; 103 + final Duration? duration;
104 104
105 /// True if you want to show a [LinearProgressIndicator]. 105 /// True if you want to show a [LinearProgressIndicator].
106 final bool showProgressIndicator; 106 final bool showProgressIndicator;
107 107
108 /// An optional [AnimationController] when you want to control the 108 /// An optional [AnimationController] when you want to control the
109 /// progress of your [LinearProgressIndicator]. 109 /// progress of your [LinearProgressIndicator].
110 - final AnimationController progressIndicatorController; 110 + final AnimationController? progressIndicatorController;
111 111
112 /// A [LinearProgressIndicator] configuration parameter. 112 /// A [LinearProgressIndicator] configuration parameter.
113 - final Color progressIndicatorBackgroundColor; 113 + final Color? progressIndicatorBackgroundColor;
114 114
115 /// A [LinearProgressIndicator] configuration parameter. 115 /// A [LinearProgressIndicator] configuration parameter.
116 - final Animation<Color> progressIndicatorValueColor; 116 + final Animation<Color>? progressIndicatorValueColor;
117 117
118 /// Determines if the user can swipe or click the overlay 118 /// Determines if the user can swipe or click the overlay
119 /// (if [overlayBlur] > 0) to dismiss. 119 /// (if [overlayBlur] > 0) to dismiss.
@@ -123,7 +123,7 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -123,7 +123,7 @@ class GetBar<T extends Object> extends StatefulWidget {
123 final bool isDismissible; 123 final bool isDismissible;
124 124
125 /// Used to limit Snack width (usually on large screens) 125 /// Used to limit Snack width (usually on large screens)
126 - final double maxWidth; 126 + final double? maxWidth;
127 127
128 /// Adds a custom margin to Snack 128 /// Adds a custom margin to Snack
129 final EdgeInsets margin; 129 final EdgeInsets margin;
@@ -140,10 +140,10 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -140,10 +140,10 @@ class GetBar<T extends Object> extends StatefulWidget {
140 /// Adds a border to every side of Snack 140 /// Adds a border to every side of Snack
141 /// I do not recommend using it with [showProgressIndicator] 141 /// I do not recommend using it with [showProgressIndicator]
142 /// or [leftBarIndicatorColor]. 142 /// or [leftBarIndicatorColor].
143 - final Color borderColor; 143 + final Color? borderColor;
144 144
145 /// Changes the width of the border if [borderColor] is specified 145 /// Changes the width of the border if [borderColor] is specified
146 - final double borderWidth; 146 + final double? borderWidth;
147 147
148 /// Snack can be based on [SnackPosition.TOP] or on [SnackPosition.BOTTOM] 148 /// Snack can be based on [SnackPosition.TOP] or on [SnackPosition.BOTTOM]
149 /// of your screen. 149 /// of your screen.
@@ -176,7 +176,7 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -176,7 +176,7 @@ class GetBar<T extends Object> extends StatefulWidget {
176 /// Default is 0.0. If different than 0.0, blurs only Snack's background. 176 /// Default is 0.0. If different than 0.0, blurs only Snack's background.
177 /// To take effect, make sure your [backgroundColor] has some opacity. 177 /// To take effect, make sure your [backgroundColor] has some opacity.
178 /// The greater the value, the greater the blur. 178 /// The greater the value, the greater the blur.
179 - final double barBlur; 179 + final double? barBlur;
180 180
181 /// Default is 0.0. If different than 0.0, creates a blurred 181 /// Default is 0.0. If different than 0.0, creates a blurred
182 /// overlay that prevents the user from interacting with the screen. 182 /// overlay that prevents the user from interacting with the screen.
@@ -186,15 +186,15 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -186,15 +186,15 @@ class GetBar<T extends Object> extends StatefulWidget {
186 /// Default is [Colors.transparent]. Only takes effect if [overlayBlur] > 0.0. 186 /// Default is [Colors.transparent]. Only takes effect if [overlayBlur] > 0.0.
187 /// Make sure you use a color with transparency here e.g. 187 /// Make sure you use a color with transparency here e.g.
188 /// Colors.grey[600].withOpacity(0.2). 188 /// Colors.grey[600].withOpacity(0.2).
189 - final Color overlayColor; 189 + final Color? overlayColor;
190 190
191 /// A [TextFormField] in case you want a simple user input. 191 /// A [TextFormField] in case you want a simple user input.
192 /// Every other widget is ignored if this is not null. 192 /// Every other widget is ignored if this is not null.
193 - final Form userInputForm; 193 + final Form? userInputForm;
194 194
195 /// Show the snack. It's call [SnackbarStatus.OPENING] state 195 /// Show the snack. It's call [SnackbarStatus.OPENING] state
196 /// followed by [SnackbarStatus.OPEN] 196 /// followed by [SnackbarStatus.OPEN]
197 - Future<T> show<T>() async { 197 + Future<T?>? show<T>() async {
198 return Get.showSnackbar(this); 198 return Get.showSnackbar(this);
199 } 199 }
200 200
@@ -206,10 +206,10 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -206,10 +206,10 @@ class GetBar<T extends Object> extends StatefulWidget {
206 206
207 class _GetBarState<K extends Object> extends State<GetBar> 207 class _GetBarState<K extends Object> extends State<GetBar>
208 with TickerProviderStateMixin { 208 with TickerProviderStateMixin {
209 - SnackbarStatus currentStatus; 209 + SnackbarStatus? currentStatus;
210 210
211 - AnimationController _fadeController;  
212 - Animation<double> _fadeAnimation; 211 + AnimationController? _fadeController;
  212 + late Animation<double> _fadeAnimation;
213 213
214 final Widget _emptyWidget = SizedBox(width: 0.0, height: 0.0); 214 final Widget _emptyWidget = SizedBox(width: 0.0, height: 0.0);
215 final double _initialOpacity = 1.0; 215 final double _initialOpacity = 1.0;
@@ -217,20 +217,20 @@ class _GetBarState<K extends Object> extends State<GetBar> @@ -217,20 +217,20 @@ class _GetBarState<K extends Object> extends State<GetBar>
217 217
218 final Duration _pulseAnimationDuration = Duration(seconds: 1); 218 final Duration _pulseAnimationDuration = Duration(seconds: 1);
219 219
220 - bool _isTitlePresent;  
221 - double _messageTopMargin; 220 + late bool _isTitlePresent;
  221 + late double _messageTopMargin;
222 222
223 - FocusScopeNode _focusNode;  
224 - FocusAttachment _focusAttachment; 223 + FocusScopeNode? _focusNode;
  224 + late FocusAttachment _focusAttachment;
225 225
226 @override 226 @override
227 void initState() { 227 void initState() {
228 super.initState(); 228 super.initState();
229 229
230 assert( 230 assert(
231 - ((widget.userInputForm != null ||  
232 - ((widget.message != null && widget.message.isNotEmpty) ||  
233 - widget.messageText != null))), 231 + widget.userInputForm != null ||
  232 + ((widget.message != null && widget.message!.isNotEmpty) ||
  233 + widget.messageText != null),
234 """ 234 """
235 A message is mandatory if you are not using userInputForm. 235 A message is mandatory if you are not using userInputForm.
236 Set either a message or messageText"""); 236 Set either a message or messageText""");
@@ -247,7 +247,7 @@ Set either a message or messageText"""); @@ -247,7 +247,7 @@ Set either a message or messageText""");
247 } 247 }
248 248
249 _focusNode = FocusScopeNode(); 249 _focusNode = FocusScopeNode();
250 - _focusAttachment = _focusNode.attach(context); 250 + _focusAttachment = _focusNode!.attach(context);
251 } 251 }
252 252
253 @override 253 @override
@@ -258,14 +258,14 @@ Set either a message or messageText"""); @@ -258,14 +258,14 @@ Set either a message or messageText""");
258 widget.progressIndicatorController?.dispose(); 258 widget.progressIndicatorController?.dispose();
259 259
260 _focusAttachment.detach(); 260 _focusAttachment.detach();
261 - _focusNode.dispose(); 261 + _focusNode!.dispose();
262 super.dispose(); 262 super.dispose();
263 } 263 }
264 264
265 final Completer<Size> _boxHeightCompleter = Completer<Size>(); 265 final Completer<Size> _boxHeightCompleter = Completer<Size>();
266 266
267 void _configureLeftBarFuture() { 267 void _configureLeftBarFuture() {
268 - SchedulerBinding.instance.addPostFrameCallback( 268 + SchedulerBinding.instance!.addPostFrameCallback(
269 (_) { 269 (_) {
270 final keyContext = backgroundBoxKey.currentContext; 270 final keyContext = backgroundBoxKey.currentContext;
271 271
@@ -282,24 +282,24 @@ Set either a message or messageText"""); @@ -282,24 +282,24 @@ Set either a message or messageText""");
282 AnimationController(vsync: this, duration: _pulseAnimationDuration); 282 AnimationController(vsync: this, duration: _pulseAnimationDuration);
283 _fadeAnimation = Tween(begin: _initialOpacity, end: _finalOpacity).animate( 283 _fadeAnimation = Tween(begin: _initialOpacity, end: _finalOpacity).animate(
284 CurvedAnimation( 284 CurvedAnimation(
285 - parent: _fadeController, 285 + parent: _fadeController!,
286 curve: Curves.linear, 286 curve: Curves.linear,
287 ), 287 ),
288 ); 288 );
289 289
290 - _fadeController.addStatusListener((status) { 290 + _fadeController!.addStatusListener((status) {
291 if (status == AnimationStatus.completed) { 291 if (status == AnimationStatus.completed) {
292 - _fadeController.reverse(); 292 + _fadeController!.reverse();
293 } 293 }
294 if (status == AnimationStatus.dismissed) { 294 if (status == AnimationStatus.dismissed) {
295 - _fadeController.forward(); 295 + _fadeController!.forward();
296 } 296 }
297 }); 297 });
298 298
299 - _fadeController.forward(); 299 + _fadeController!.forward();
300 } 300 }
301 301
302 - VoidCallback _progressListener; 302 + late VoidCallback _progressListener;
303 303
304 void _configureProgressIndicatorAnimation() { 304 void _configureProgressIndicatorAnimation() {
305 if (widget.showProgressIndicator && 305 if (widget.showProgressIndicator &&
@@ -307,10 +307,10 @@ Set either a message or messageText"""); @@ -307,10 +307,10 @@ Set either a message or messageText""");
307 _progressListener = () { 307 _progressListener = () {
308 setState(() {}); 308 setState(() {});
309 }; 309 };
310 - widget.progressIndicatorController.addListener(_progressListener); 310 + widget.progressIndicatorController!.addListener(_progressListener);
311 311
312 _progressAnimation = CurvedAnimation( 312 _progressAnimation = CurvedAnimation(
313 - curve: Curves.linear, parent: widget.progressIndicatorController); 313 + curve: Curves.linear, parent: widget.progressIndicatorController!);
314 } 314 }
315 } 315 }
316 316
@@ -361,10 +361,10 @@ Set either a message or messageText"""); @@ -361,10 +361,10 @@ Set either a message or messageText""");
361 borderRadius: BorderRadius.circular(widget.borderRadius), 361 borderRadius: BorderRadius.circular(widget.borderRadius),
362 child: BackdropFilter( 362 child: BackdropFilter(
363 filter: ImageFilter.blur( 363 filter: ImageFilter.blur(
364 - sigmaX: widget.barBlur, sigmaY: widget.barBlur), 364 + sigmaX: widget.barBlur!, sigmaY: widget.barBlur!),
365 child: Container( 365 child: Container(
366 - height: snapshot.data.height,  
367 - width: snapshot.data.width, 366 + height: snapshot.data!.height,
  367 + width: snapshot.data!.width,
368 decoration: BoxDecoration( 368 decoration: BoxDecoration(
369 color: Colors.transparent, 369 color: Colors.transparent,
370 borderRadius: BorderRadius.circular(widget.borderRadius), 370 borderRadius: BorderRadius.circular(widget.borderRadius),
@@ -386,7 +386,7 @@ Set either a message or messageText"""); @@ -386,7 +386,7 @@ Set either a message or messageText""");
386 return Container( 386 return Container(
387 key: backgroundBoxKey, 387 key: backgroundBoxKey,
388 constraints: widget.maxWidth != null 388 constraints: widget.maxWidth != null
389 - ? BoxConstraints(maxWidth: widget.maxWidth) 389 + ? BoxConstraints(maxWidth: widget.maxWidth!)
390 : null, 390 : null,
391 decoration: BoxDecoration( 391 decoration: BoxDecoration(
392 color: widget.backgroundColor, 392 color: widget.backgroundColor,
@@ -394,14 +394,14 @@ Set either a message or messageText"""); @@ -394,14 +394,14 @@ Set either a message or messageText""");
394 boxShadow: widget.boxShadows, 394 boxShadow: widget.boxShadows,
395 borderRadius: BorderRadius.circular(widget.borderRadius), 395 borderRadius: BorderRadius.circular(widget.borderRadius),
396 border: widget.borderColor != null 396 border: widget.borderColor != null
397 - ? Border.all(color: widget.borderColor, width: widget.borderWidth) 397 + ? Border.all(color: widget.borderColor!, width: widget.borderWidth!)
398 : null, 398 : null,
399 ), 399 ),
400 child: Padding( 400 child: Padding(
401 padding: const EdgeInsets.only( 401 padding: const EdgeInsets.only(
402 left: 8.0, right: 8.0, bottom: 8.0, top: 16.0), 402 left: 8.0, right: 8.0, bottom: 8.0, top: 16.0),
403 child: FocusScope( 403 child: FocusScope(
404 - child: widget.userInputForm, 404 + child: widget.userInputForm!,
405 node: _focusNode, 405 node: _focusNode,
406 autofocus: true, 406 autofocus: true,
407 ), 407 ),
@@ -409,14 +409,14 @@ Set either a message or messageText"""); @@ -409,14 +409,14 @@ Set either a message or messageText""");
409 ); 409 );
410 } 410 }
411 411
412 - CurvedAnimation _progressAnimation; 412 + late CurvedAnimation _progressAnimation;
413 GlobalKey backgroundBoxKey = GlobalKey(); 413 GlobalKey backgroundBoxKey = GlobalKey();
414 414
415 Widget _generateSnack() { 415 Widget _generateSnack() {
416 return Container( 416 return Container(
417 key: backgroundBoxKey, 417 key: backgroundBoxKey,
418 constraints: widget.maxWidth != null 418 constraints: widget.maxWidth != null
419 - ? BoxConstraints(maxWidth: widget.maxWidth) 419 + ? BoxConstraints(maxWidth: widget.maxWidth!)
420 : null, 420 : null,
421 decoration: BoxDecoration( 421 decoration: BoxDecoration(
422 color: widget.backgroundColor, 422 color: widget.backgroundColor,
@@ -424,7 +424,7 @@ Set either a message or messageText"""); @@ -424,7 +424,7 @@ Set either a message or messageText""");
424 boxShadow: widget.boxShadows, 424 boxShadow: widget.boxShadows,
425 borderRadius: BorderRadius.circular(widget.borderRadius), 425 borderRadius: BorderRadius.circular(widget.borderRadius),
426 border: widget.borderColor != null 426 border: widget.borderColor != null
427 - ? Border.all(color: widget.borderColor, width: widget.borderWidth) 427 + ? Border.all(color: widget.borderColor!, width: widget.borderWidth!)
428 : null, 428 : null,
429 ), 429 ),
430 child: Column( 430 child: Column(
@@ -618,7 +618,7 @@ Set either a message or messageText"""); @@ -618,7 +618,7 @@ Set either a message or messageText""");
618 return Container( 618 return Container(
619 color: widget.leftBarIndicatorColor, 619 color: widget.leftBarIndicatorColor,
620 width: 5.0, 620 width: 5.0,
621 - height: snapshot.data.height, 621 + height: snapshot.data!.height,
622 ); 622 );
623 } else { 623 } else {
624 return _emptyWidget; 624 return _emptyWidget;
@@ -630,7 +630,7 @@ Set either a message or messageText"""); @@ -630,7 +630,7 @@ Set either a message or messageText""");
630 } 630 }
631 } 631 }
632 632
633 - Widget _getIcon() { 633 + Widget? _getIcon() {
634 if (widget.icon != null && widget.icon is Icon && widget.shouldIconPulse) { 634 if (widget.icon != null && widget.icon is Icon && widget.shouldIconPulse) {
635 return FadeTransition( 635 return FadeTransition(
636 opacity: _fadeAnimation, 636 opacity: _fadeAnimation,
@@ -659,7 +659,7 @@ Set either a message or messageText"""); @@ -659,7 +659,7 @@ Set either a message or messageText""");
659 ); 659 );
660 } 660 }
661 661
662 - Widget _getMainActionButton() { 662 + Widget? _getMainActionButton() {
663 return widget.mainButton; 663 return widget.mainButton;
664 } 664 }
665 } 665 }
@@ -6,17 +6,17 @@ import '../../get_navigation.dart'; @@ -6,17 +6,17 @@ import '../../get_navigation.dart';
6 import 'snack.dart'; 6 import 'snack.dart';
7 7
8 class SnackRoute<T> extends OverlayRoute<T> { 8 class SnackRoute<T> extends OverlayRoute<T> {
9 - Animation<double> _filterBlurAnimation;  
10 - Animation<Color> _filterColorAnimation; 9 + late Animation<double> _filterBlurAnimation;
  10 + late Animation<Color?> _filterColorAnimation;
11 11
12 SnackRoute({ 12 SnackRoute({
13 - @required this.snack,  
14 - RouteSettings settings, 13 + required this.snack,
  14 + RouteSettings? settings,
15 }) : super(settings: settings) { 15 }) : super(settings: settings) {
16 _builder = Builder(builder: (_) { 16 _builder = Builder(builder: (_) {
17 return GestureDetector( 17 return GestureDetector(
18 child: snack, 18 child: snack,
19 - onTap: snack.onTap != null ? () => snack.onTap(snack) : null, 19 + onTap: snack.onTap != null ? () => snack.onTap!(snack) : null,
20 ); 20 );
21 }); 21 });
22 22
@@ -42,17 +42,17 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -42,17 +42,17 @@ class SnackRoute<T> extends OverlayRoute<T> {
42 } 42 }
43 43
44 GetBar snack; 44 GetBar snack;
45 - Builder _builder; 45 + Builder? _builder;
46 46
47 final Completer<T> _transitionCompleter = Completer<T>(); 47 final Completer<T> _transitionCompleter = Completer<T>();
48 48
49 - SnackbarStatusCallback _snackbarStatus;  
50 - Alignment _initialAlignment;  
51 - Alignment _endAlignment; 49 + late SnackbarStatusCallback _snackbarStatus;
  50 + Alignment? _initialAlignment;
  51 + Alignment? _endAlignment;
52 bool _wasDismissedBySwipe = false; 52 bool _wasDismissedBySwipe = false;
53 bool _onTappedDismiss = false; 53 bool _onTappedDismiss = false;
54 54
55 - Timer _timer; 55 + Timer? _timer;
56 56
57 bool get opaque => false; 57 bool get opaque => false;
58 58
@@ -93,7 +93,7 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -93,7 +93,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
93 builder: (context) { 93 builder: (context) {
94 final Widget annotatedChild = Semantics( 94 final Widget annotatedChild = Semantics(
95 child: AlignTransition( 95 child: AlignTransition(
96 - alignment: _animation, 96 + alignment: _animation!,
97 child: snack.isDismissible 97 child: snack.isDismissible
98 ? _getDismissibleSnack(_builder) 98 ? _getDismissibleSnack(_builder)
99 : _getSnack(), 99 : _getSnack(),
@@ -112,7 +112,7 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -112,7 +112,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
112 112
113 String dismissibleKeyGen = ""; 113 String dismissibleKeyGen = "";
114 114
115 - Widget _getDismissibleSnack(Widget child) { 115 + Widget _getDismissibleSnack(Widget? child) {
116 return Dismissible( 116 return Dismissible(
117 direction: _getDismissDirection(), 117 direction: _getDismissDirection(),
118 resizeDuration: null, 118 resizeDuration: null,
@@ -130,9 +130,9 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -130,9 +130,9 @@ class SnackRoute<T> extends OverlayRoute<T> {
130 _wasDismissedBySwipe = true; 130 _wasDismissedBySwipe = true;
131 131
132 if (isCurrent) { 132 if (isCurrent) {
133 - navigator.pop(); 133 + navigator!.pop();
134 } else { 134 } else {
135 - navigator.removeRoute(this); 135 + navigator!.removeRoute(this);
136 } 136 }
137 }, 137 },
138 child: _getSnack(), 138 child: _getSnack(),
@@ -159,16 +159,16 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -159,16 +159,16 @@ class SnackRoute<T> extends OverlayRoute<T> {
159 159
160 @override 160 @override
161 bool get finishedWhenPopped => 161 bool get finishedWhenPopped =>
162 - _controller.status == AnimationStatus.dismissed; 162 + _controller!.status == AnimationStatus.dismissed;
163 163
164 /// The animation that drives the route's transition and the previous route's 164 /// The animation that drives the route's transition and the previous route's
165 /// forward transition. 165 /// forward transition.
166 - Animation<Alignment> _animation; 166 + Animation<Alignment>? _animation;
167 167
168 /// The animation controller that the route uses to drive the transitions. 168 /// The animation controller that the route uses to drive the transitions.
169 /// 169 ///
170 /// The animation itself is exposed by the [animation] property. 170 /// The animation itself is exposed by the [animation] property.
171 - AnimationController _controller; 171 + AnimationController? _controller;
172 172
173 /// Called to create the animation controller that will drive the transitions 173 /// Called to create the animation controller that will drive the transitions
174 /// to this route from the previous one, and back to the previous route 174 /// to this route from the previous one, and back to the previous route
@@ -181,7 +181,7 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -181,7 +181,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
181 return AnimationController( 181 return AnimationController(
182 duration: snack.animationDuration, 182 duration: snack.animationDuration,
183 debugLabel: debugLabel, 183 debugLabel: debugLabel,
184 - vsync: navigator, 184 + vsync: navigator!,
185 ); 185 );
186 } 186 }
187 187
@@ -194,7 +194,7 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -194,7 +194,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
194 assert(_controller != null); 194 assert(_controller != null);
195 return AlignmentTween(begin: _initialAlignment, end: _endAlignment).animate( 195 return AlignmentTween(begin: _initialAlignment, end: _endAlignment).animate(
196 CurvedAnimation( 196 CurvedAnimation(
197 - parent: _controller, 197 + parent: _controller!,
198 curve: snack.forwardAnimationCurve, 198 curve: snack.forwardAnimationCurve,
199 reverseCurve: snack.reverseAnimationCurve, 199 reverseCurve: snack.reverseAnimationCurve,
200 ), 200 ),
@@ -204,7 +204,7 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -204,7 +204,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
204 Animation<double> createBlurFilterAnimation() { 204 Animation<double> createBlurFilterAnimation() {
205 return Tween(begin: 0.0, end: snack.overlayBlur).animate( 205 return Tween(begin: 0.0, end: snack.overlayBlur).animate(
206 CurvedAnimation( 206 CurvedAnimation(
207 - parent: _controller, 207 + parent: _controller!,
208 curve: Interval( 208 curve: Interval(
209 0.0, 209 0.0,
210 0.35, 210 0.35,
@@ -214,11 +214,11 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -214,11 +214,11 @@ class SnackRoute<T> extends OverlayRoute<T> {
214 ); 214 );
215 } 215 }
216 216
217 - Animation<Color> createColorFilterAnimation() { 217 + Animation<Color?> createColorFilterAnimation() {
218 return ColorTween(begin: Color(0x00000000), end: snack.overlayColor) 218 return ColorTween(begin: Color(0x00000000), end: snack.overlayColor)
219 .animate( 219 .animate(
220 CurvedAnimation( 220 CurvedAnimation(
221 - parent: _controller, 221 + parent: _controller!,
222 curve: Interval( 222 curve: Interval(
223 0.0, 223 0.0,
224 0.35, 224 0.35,
@@ -228,8 +228,8 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -228,8 +228,8 @@ class SnackRoute<T> extends OverlayRoute<T> {
228 ); 228 );
229 } 229 }
230 230
231 - T _result;  
232 - SnackbarStatus currentStatus; 231 + T? _result;
  232 + SnackbarStatus? currentStatus;
233 233
234 void _handleStatusChanged(AnimationStatus status) { 234 void _handleStatusChanged(AnimationStatus status) {
235 switch (status) { 235 switch (status) {
@@ -258,7 +258,7 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -258,7 +258,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
258 _snackbarStatus(currentStatus); 258 _snackbarStatus(currentStatus);
259 259
260 if (!isCurrent) { 260 if (!isCurrent) {
261 - navigator.finalizeRoute(this); 261 + navigator!.finalizeRoute(this);
262 // assert(overlayEntries.isEmpty); 262 // assert(overlayEntries.isEmpty);
263 } 263 }
264 break; 264 break;
@@ -292,13 +292,13 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -292,13 +292,13 @@ class SnackRoute<T> extends OverlayRoute<T> {
292 !_transitionCompleter.isCompleted, 292 !_transitionCompleter.isCompleted,
293 'Cannot reuse a $runtimeType after disposing it.', 293 'Cannot reuse a $runtimeType after disposing it.',
294 ); 294 );
295 - _animation.addStatusListener(_handleStatusChanged); 295 + _animation!.addStatusListener(_handleStatusChanged);
296 _configureTimer(); 296 _configureTimer();
297 - return _controller.forward(); 297 + return _controller!.forward();
298 } 298 }
299 299
300 @override 300 @override
301 - void didReplace(Route<dynamic> oldRoute) { 301 + void didReplace(Route<dynamic>? oldRoute) {
302 assert( 302 assert(
303 _controller != null, 303 _controller != null,
304 // ignore: lines_longer_than_80_chars 304 // ignore: lines_longer_than_80_chars
@@ -310,14 +310,14 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -310,14 +310,14 @@ class SnackRoute<T> extends OverlayRoute<T> {
310 ); 310 );
311 311
312 if (oldRoute is SnackRoute) { 312 if (oldRoute is SnackRoute) {
313 - _controller.value = oldRoute._controller.value; 313 + _controller!.value = oldRoute._controller!.value;
314 } 314 }
315 - _animation.addStatusListener(_handleStatusChanged); 315 + _animation!.addStatusListener(_handleStatusChanged);
316 super.didReplace(oldRoute); 316 super.didReplace(oldRoute);
317 } 317 }
318 318
319 @override 319 @override
320 - bool didPop(T result) { 320 + bool didPop(T? result) {
321 assert( 321 assert(
322 _controller != null, 322 _controller != null,
323 // ignore: lines_longer_than_80_chars 323 // ignore: lines_longer_than_80_chars
@@ -333,12 +333,12 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -333,12 +333,12 @@ class SnackRoute<T> extends OverlayRoute<T> {
333 333
334 if (_wasDismissedBySwipe) { 334 if (_wasDismissedBySwipe) {
335 Timer(Duration(milliseconds: 200), () { 335 Timer(Duration(milliseconds: 200), () {
336 - _controller.reset(); 336 + _controller!.reset();
337 }); 337 });
338 338
339 _wasDismissedBySwipe = false; 339 _wasDismissedBySwipe = false;
340 } else { 340 } else {
341 - _controller.reverse(); 341 + _controller!.reverse();
342 } 342 }
343 343
344 return super.didPop(result); 344 return super.didPop(result);
@@ -346,26 +346,26 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -346,26 +346,26 @@ class SnackRoute<T> extends OverlayRoute<T> {
346 346
347 void _configureTimer() { 347 void _configureTimer() {
348 if (snack.duration != null) { 348 if (snack.duration != null) {
349 - if (_timer != null && _timer.isActive) {  
350 - _timer.cancel(); 349 + if (_timer != null && _timer!.isActive) {
  350 + _timer!.cancel();
351 } 351 }
352 - _timer = Timer(snack.duration, () { 352 + _timer = Timer(snack.duration!, () {
353 if (isCurrent) { 353 if (isCurrent) {
354 - navigator.pop(); 354 + navigator!.pop();
355 } else if (isActive) { 355 } else if (isActive) {
356 - navigator.removeRoute(this); 356 + navigator!.removeRoute(this);
357 } 357 }
358 }); 358 });
359 } else { 359 } else {
360 if (_timer != null) { 360 if (_timer != null) {
361 - _timer.cancel(); 361 + _timer!.cancel();
362 } 362 }
363 } 363 }
364 } 364 }
365 365
366 void _cancelTimer() { 366 void _cancelTimer() {
367 - if (_timer != null && _timer.isActive) {  
368 - _timer.cancel(); 367 + if (_timer != null && _timer!.isActive) {
  368 + _timer!.cancel();
369 } 369 }
370 } 370 }
371 371