Showing
37 changed files
with
199 additions
and
154 deletions
No preview for this file type
1 | +## [4.2.1] | ||
2 | +- Remove [] from docs to try fix pub score | ||
3 | + | ||
1 | ## [4.2.0] - Big update | 4 | ## [4.2.0] - Big update |
2 | 5 | ||
3 | This update fixes important bugs as well as integrates with Navigator 2. It also adds GetRouterOutlet, similar to angular RouterOutlet thanks to @ahmednfwela. Also, the documentation translation for Vietnamese (@khangahs) has been added, making the GetX documentation available for 11 different languages, which is just fantastic for any opensource project. GetX has achieved more than 5.4k likes from the pub, and more than 4k stars on github, has videos about it with 48k on youtube, and has communities in the 4 hemispheres of the earth, besides having a large list of contributors as you see bellow. We're all happy to facilitate development with dart and flutter, and that making programming hassle-free has been taken around the world. | 6 | This update fixes important bugs as well as integrates with Navigator 2. It also adds GetRouterOutlet, similar to angular RouterOutlet thanks to @ahmednfwela. Also, the documentation translation for Vietnamese (@khangahs) has been added, making the GetX documentation available for 11 different languages, which is just fantastic for any opensource project. GetX has achieved more than 5.4k likes from the pub, and more than 4k stars on github, has videos about it with 48k on youtube, and has communities in the 4 hemispheres of the earth, besides having a large list of contributors as you see bellow. We're all happy to facilitate development with dart and flutter, and that making programming hassle-free has been taken around the world. |
@@ -15,11 +15,11 @@ class MyApp extends StatelessWidget { | @@ -15,11 +15,11 @@ class MyApp extends StatelessWidget { | ||
15 | 15 | ||
16 | @override | 16 | @override |
17 | Widget build(BuildContext context) { | 17 | Widget build(BuildContext context) { |
18 | - return GetMaterialApp( | 18 | + return GetMaterialApp.router( |
19 | debugShowCheckedModeBanner: false, | 19 | debugShowCheckedModeBanner: false, |
20 | enableLog: true, | 20 | enableLog: true, |
21 | logWriterCallback: Logger.write, | 21 | logWriterCallback: Logger.write, |
22 | - initialRoute: AppPages.INITIAL, | 22 | + // initialRoute: AppPages.INITIAL, |
23 | getPages: AppPages.routes, | 23 | getPages: AppPages.routes, |
24 | locale: TranslationService.locale, | 24 | locale: TranslationService.locale, |
25 | fallbackLocale: TranslationService.fallbackLocale, | 25 | fallbackLocale: TranslationService.fallbackLocale, |
@@ -33,7 +33,8 @@ class CountryView extends GetView<HomeController> { | @@ -33,7 +33,8 @@ class CountryView extends GetView<HomeController> { | ||
33 | final country = controller.state!.countries[index]; | 33 | final country = controller.state!.countries[index]; |
34 | return ListTile( | 34 | return ListTile( |
35 | onTap: () { | 35 | onTap: () { |
36 | - Get.toNamed('/home/country/details', | 36 | + //Get.rootDelegate.toNamed('/home/country'); |
37 | + Get.rootDelegate.toNamed('/home/country/details', | ||
37 | arguments: country); | 38 | arguments: country); |
38 | }, | 39 | }, |
39 | trailing: CircleAvatar( | 40 | trailing: CircleAvatar( |
@@ -8,7 +8,7 @@ import '../../domain/entity/cases_model.dart'; | @@ -8,7 +8,7 @@ import '../../domain/entity/cases_model.dart'; | ||
8 | class DetailsView extends StatelessWidget { | 8 | class DetailsView extends StatelessWidget { |
9 | @override | 9 | @override |
10 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
11 | - final country = Get.arguments as Country; | 11 | + final country = Get.rootDelegate.arguments<Country>(); |
12 | return Container( | 12 | return Container( |
13 | decoration: BoxDecoration( | 13 | decoration: BoxDecoration( |
14 | image: DecorationImage( | 14 | image: DecorationImage( |
@@ -71,7 +71,7 @@ class HomeView extends GetView<HomeController> { | @@ -71,7 +71,7 @@ class HomeView extends GetView<HomeController> { | ||
71 | shape: StadiumBorder(), | 71 | shape: StadiumBorder(), |
72 | ), | 72 | ), |
73 | onPressed: () { | 73 | onPressed: () { |
74 | - Get.toNamed('/home/country'); | 74 | + Get.rootDelegate.toNamed('/home/country'); |
75 | }, | 75 | }, |
76 | child: Text( | 76 | child: Text( |
77 | 'fetch_country'.tr, | 77 | 'fetch_country'.tr, |
@@ -314,7 +314,6 @@ class GetConnect extends GetConnectInterface { | @@ -314,7 +314,6 @@ class GetConnect extends GetConnectInterface { | ||
314 | 314 | ||
315 | final listError = res.body['errors']; | 315 | final listError = res.body['errors']; |
316 | if ((listError is List) && listError.isNotEmpty) { | 316 | if ((listError is List) && listError.isNotEmpty) { |
317 | - // return GraphQLResponse<T>(body: res.body['data'] as T); | ||
318 | return GraphQLResponse<T>( | 317 | return GraphQLResponse<T>( |
319 | graphQLErrors: listError | 318 | graphQLErrors: listError |
320 | .map((e) => GraphQLError( | 319 | .map((e) => GraphQLError( |
@@ -350,7 +349,6 @@ class GetConnect extends GetConnectInterface { | @@ -350,7 +349,6 @@ class GetConnect extends GetConnectInterface { | ||
350 | 349 | ||
351 | final listError = res.body['errors']; | 350 | final listError = res.body['errors']; |
352 | if ((listError is List) && listError.isNotEmpty) { | 351 | if ((listError is List) && listError.isNotEmpty) { |
353 | - // return GraphQLResponse<T>(body: res.body['data'] as T); | ||
354 | return GraphQLResponse<T>( | 352 | return GraphQLResponse<T>( |
355 | graphQLErrors: listError | 353 | graphQLErrors: listError |
356 | .map((e) => GraphQLError( | 354 | .map((e) => GraphQLError( |
@@ -184,8 +184,10 @@ class GetHttpClient { | @@ -184,8 +184,10 @@ class GetHttpClient { | ||
184 | String? contentType, | 184 | String? contentType, |
185 | ) { | 185 | ) { |
186 | headers['content-type'] = contentType ?? defaultContentType; | 186 | headers['content-type'] = contentType ?? defaultContentType; |
187 | + if (sendUserAgent) { | ||
187 | headers['user-agent'] = userAgent; | 188 | headers['user-agent'] = userAgent; |
188 | } | 189 | } |
190 | + } | ||
189 | 191 | ||
190 | Future<Response<T>> _performRequest<T>( | 192 | Future<Response<T>> _performRequest<T>( |
191 | HandlerExecute<T> handler, { | 193 | HandlerExecute<T> handler, { |
@@ -4,7 +4,7 @@ List<int> fileToBytes(dynamic data) { | @@ -4,7 +4,7 @@ List<int> fileToBytes(dynamic data) { | ||
4 | if (data is List<int>) { | 4 | if (data is List<int>) { |
5 | return data; | 5 | return data; |
6 | } else { | 6 | } else { |
7 | - throw FormatException('File is not [File] or [String] or [List<int>]'); | 7 | + throw FormatException('File is not "File" or "String" or "List<int>"'); |
8 | } | 8 | } |
9 | } | 9 | } |
10 | 10 |
@@ -7,12 +7,12 @@ List<int> fileToBytes(dynamic data) { | @@ -7,12 +7,12 @@ List<int> fileToBytes(dynamic data) { | ||
7 | if (File(data).existsSync()) { | 7 | if (File(data).existsSync()) { |
8 | return File(data).readAsBytesSync(); | 8 | return File(data).readAsBytesSync(); |
9 | } else { | 9 | } else { |
10 | - throw 'File [data] not exists'; | 10 | + throw 'File $data not exists'; |
11 | } | 11 | } |
12 | } else if (data is List<int>) { | 12 | } else if (data is List<int>) { |
13 | return data; | 13 | return data; |
14 | } else { | 14 | } else { |
15 | - throw FormatException('File is not [File] or [String] or [List<int>]'); | 15 | + throw FormatException('File is not "File" or "String" or "List<int>"'); |
16 | } | 16 | } |
17 | } | 17 | } |
18 | 18 |
@@ -34,7 +34,6 @@ class HttpRequestImpl extends HttpRequestBase { | @@ -34,7 +34,6 @@ class HttpRequestImpl extends HttpRequestBase { | ||
34 | @override | 34 | @override |
35 | Future<Response<T>> send<T>(Request<T> request) async { | 35 | Future<Response<T>> send<T>(Request<T> request) async { |
36 | var stream = request.bodyBytes.asBroadcastStream(); | 36 | var stream = request.bodyBytes.asBroadcastStream(); |
37 | - //var stream = BodyBytesStream.fromBytes(requestBody ?? const []); | ||
38 | 37 | ||
39 | try { | 38 | try { |
40 | var ioRequest = (await _httpClient!.openUrl(request.method, request.url)) | 39 | var ioRequest = (await _httpClient!.openUrl(request.method, request.url)) |
@@ -36,7 +36,7 @@ class FormData { | @@ -36,7 +36,7 @@ class FormData { | ||
36 | /// The form fields to send for this request. | 36 | /// The form fields to send for this request. |
37 | final fields = <MapEntry<String, String>>[]; | 37 | final fields = <MapEntry<String, String>>[]; |
38 | 38 | ||
39 | - /// The [files] to send for this request | 39 | + /// The files to send for this request |
40 | final files = <MapEntry<String, MultipartFile>>[]; | 40 | final files = <MapEntry<String, MultipartFile>>[]; |
41 | 41 | ||
42 | /// Returns the header string for a field. The return value is guaranteed to | 42 | /// Returns the header string for a field. The return value is guaranteed to |
@@ -66,7 +66,7 @@ class Response<T> { | @@ -66,7 +66,7 @@ class Response<T> { | ||
66 | 66 | ||
67 | /// The decoded body of this [Response]. You can access the | 67 | /// The decoded body of this [Response]. You can access the |
68 | /// body parameters as Map | 68 | /// body parameters as Map |
69 | - /// Ex: body['title']; | 69 | + /// Ex: `body['title'];` |
70 | final T? body; | 70 | final T? body; |
71 | } | 71 | } |
72 | 72 | ||
@@ -91,7 +91,7 @@ Encoding _encodingForCharset(String? charset, [Encoding fallback = utf8]) { | @@ -91,7 +91,7 @@ Encoding _encodingForCharset(String? charset, [Encoding fallback = utf8]) { | ||
91 | return Encoding.getByName(charset) ?? fallback; | 91 | return Encoding.getByName(charset) ?? fallback; |
92 | } | 92 | } |
93 | 93 | ||
94 | -/// Returns the [MediaType] object for the given headers's content-type. | 94 | +/// Returns the MediaType object for the given headers's content-type. |
95 | /// | 95 | /// |
96 | /// Defaults to `application/octet-stream`. | 96 | /// Defaults to `application/octet-stream`. |
97 | HeaderValue _contentTypeForHeaders(Map<String, String> headers) { | 97 | HeaderValue _contentTypeForHeaders(Map<String, String> headers) { |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | /// not being used and were not set to be permanent. In the majority | 5 | /// not being used and were not set to be permanent. In the majority |
6 | /// of the cases you will want to keep this config untouched. | 6 | /// of the cases you will want to keep this config untouched. |
7 | /// If you new to GetX then don't change this. | 7 | /// If you new to GetX then don't change this. |
8 | -/// [SmartManagement.onlyBuilders] only controllers started in init: | 8 | +/// [SmartManagement.onlyBuilder] only controllers started in init: |
9 | /// or loaded into a Binding with Get.lazyPut() will be disposed. If you use | 9 | /// or loaded into a Binding with Get.lazyPut() will be disposed. If you use |
10 | /// Get.put() or Get.putAsync() or any other approach, SmartManagement | 10 | /// Get.put() or Get.putAsync() or any other approach, SmartManagement |
11 | /// will not have permissions to exclude this dependency. With the default | 11 | /// will not have permissions to exclude this dependency. With the default |
1 | import 'get_instance.dart'; | 1 | import 'get_instance.dart'; |
2 | 2 | ||
3 | /// [Bindings] should be extended or implemented. | 3 | /// [Bindings] should be extended or implemented. |
4 | -/// When using [GetMaterialApp], all [GetPage]s and navigation | ||
5 | -/// methods (like Get.to()) have a [binding] property that takes an | 4 | +/// When using `GetMaterialApp`, all `GetPage`s and navigation |
5 | +/// methods (like Get.to()) have a `binding` property that takes an | ||
6 | /// instance of Bindings to manage the | 6 | /// instance of Bindings to manage the |
7 | -/// dependencies() (via [Get.put()]) for the Route you are opening. | 7 | +/// dependencies() (via Get.put()) for the Route you are opening. |
8 | // ignore: one_member_abstracts | 8 | // ignore: one_member_abstracts |
9 | abstract class Bindings { | 9 | abstract class Bindings { |
10 | void dependencies(); | 10 | void dependencies(); |
@@ -3,30 +3,30 @@ import '../../route_manager.dart'; | @@ -3,30 +3,30 @@ import '../../route_manager.dart'; | ||
3 | import 'get_instance.dart'; | 3 | import 'get_instance.dart'; |
4 | 4 | ||
5 | extension Inst on GetInterface { | 5 | extension Inst on GetInterface { |
6 | - /// Creates a new Instance<S> lazily from the [<S>builder()] callback. | 6 | + /// Creates a new Instance<S> lazily from the `<S>builder()` callback. |
7 | /// | 7 | /// |
8 | - /// The first time you call [Get.find()], the [builder()] callback will create | 8 | + /// The first time you call `Get.find()`, the `builder()` callback will create |
9 | /// the Instance and persisted as a Singleton (like you would use | 9 | /// the Instance and persisted as a Singleton (like you would use |
10 | - /// [Get.put()]). | 10 | + /// `Get.put()`). |
11 | /// | 11 | /// |
12 | - /// Using [Get.smartManagement] as [SmartManagement.keepFactory] has | 12 | + /// Using `Get.smartManagement` as [SmartManagement.keepFactory] has |
13 | /// the same outcome | 13 | /// the same outcome |
14 | - /// as using [fenix:true] : | ||
15 | - /// The internal register of [builder()] will remain in memory to recreate | ||
16 | - /// the Instance if the Instance has been removed with [Get.delete()]. | ||
17 | - /// Therefore, future calls to [Get.find()] will return the same Instance. | 14 | + /// as using `fenix:true` : |
15 | + /// The internal register of `builder()` will remain in memory to recreate | ||
16 | + /// the Instance if the Instance has been removed with `Get.delete()`. | ||
17 | + /// Therefore, future calls to `Get.find()` will return the same Instance. | ||
18 | /// | 18 | /// |
19 | /// If you need to make use of GetxController's life-cycle | 19 | /// If you need to make use of GetxController's life-cycle |
20 | - /// ([onInit(), onStart(), onClose()]) | ||
21 | - /// [fenix] is a great choice to mix with [GetBuilder()] and [GetX()] widgets, | 20 | + /// (`onInit(), onStart(), onClose()`) |
21 | + /// [fenix] is a great choice to mix with `GetBuilder` and `GetX` widgets, | ||
22 | /// and/or [GetMaterialApp] Navigation. | 22 | /// and/or [GetMaterialApp] Navigation. |
23 | /// | 23 | /// |
24 | - /// You could use [Get.lazyPut(fenix:true)] in your app's [main()] instead of | ||
25 | - /// [Bindings()] for each [GetPage]. | 24 | + /// You could use `Get.lazyPut(fenix:true)` in your app's `main()` instead of |
25 | + /// `Bindings` for each [GetPage]. | ||
26 | /// And the memory management will be similar. | 26 | /// And the memory management will be similar. |
27 | /// | 27 | /// |
28 | - /// Subsequent calls to [Get.lazyPut()] with the same parameters | ||
29 | - /// (<[S]> and optionally [tag] will **not** override the original). | 28 | + /// Subsequent calls to `Get.lazyPut` with the same parameters |
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); |
@@ -36,21 +36,21 @@ extension Inst on GetInterface { | @@ -36,21 +36,21 @@ extension Inst on GetInterface { | ||
36 | GetInstance().printInstanceStack(); | 36 | GetInstance().printInstanceStack(); |
37 | } | 37 | } |
38 | 38 | ||
39 | - /// async version of [Get.put()]. | ||
40 | - /// Awaits for the resolution of the Future from [builder()] parameter and | 39 | + /// async version of `Get.put()`. |
40 | + /// Awaits for the resolution of the Future from `builder()`parameter and | ||
41 | /// stores the Instance returned. | 41 | /// stores the Instance returned. |
42 | Future<S> putAsync<S>(AsyncInstanceBuilderCallback<S> builder, | 42 | Future<S> putAsync<S>(AsyncInstanceBuilderCallback<S> builder, |
43 | {String? tag, bool permanent = false}) async => | 43 | {String? tag, bool permanent = false}) async => |
44 | GetInstance().putAsync<S>(builder, tag: tag, permanent: permanent); | 44 | GetInstance().putAsync<S>(builder, tag: tag, permanent: permanent); |
45 | 45 | ||
46 | /// Creates a new Class Instance [S] from the builder callback[S]. | 46 | /// Creates a new Class Instance [S] from the builder callback[S]. |
47 | - /// Every time [find]<[S]>() is used, it calls the builder method to generate | 47 | + /// Every time `find<S>()` is used, it calls the builder method to generate |
48 | /// a new Instance [S]. | 48 | /// a new Instance [S]. |
49 | - /// It also registers each [instance.onClose()] with the current | ||
50 | - /// Route [GetConfig.currentRoute] to keep the lifecycle active. | 49 | + /// It also registers each `instance.onClose()` with the current |
50 | + /// Route `GetConfig.currentRoute` to keep the lifecycle active. | ||
51 | /// Is important to know that the instances created are only stored per Route. | 51 | /// Is important to know that the instances created are only stored per Route. |
52 | /// So, if you call `Get.delete<T>()` the "instance factory" used in this | 52 | /// So, if you call `Get.delete<T>()` the "instance factory" used in this |
53 | - /// method ([Get.create<T>()]) will be removed, but NOT the instances | 53 | + /// method (`Get.create<T>()`) will be removed, but NOT the instances |
54 | /// already created by it. | 54 | /// already created by it. |
55 | /// Uses `tag` as the other methods. | 55 | /// Uses `tag` as the other methods. |
56 | /// | 56 | /// |
@@ -64,24 +64,24 @@ extension Inst on GetInterface { | @@ -64,24 +64,24 @@ extension Inst on GetInterface { | ||
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]) | ||
68 | - /// In the case of using [Get.create()], it will generate an Instance | ||
69 | - /// each time you call [Get.find()]. | 67 | + /// Finds a Instance of the required Class `<S>`(or [tag]) |
68 | + /// In the case of using `Get.create()`, it will generate an Instance | ||
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 | /// |
74 | - /// No need to define the generic type <[S]> as it's inferred | 74 | + /// No need to define the generic type `<[S]>` as it's inferred |
75 | /// from the [dependency] parameter. | 75 | /// from the [dependency] parameter. |
76 | /// | 76 | /// |
77 | /// - [dependency] The Instance to be injected. | 77 | /// - [dependency] The Instance to be injected. |
78 | /// - [tag] optionally, use a [tag] as an "id" to create multiple records | 78 | /// - [tag] optionally, use a [tag] as an "id" to create multiple records |
79 | - /// of the same Type<[S]> the [tag] does **not** conflict with the same tags | ||
80 | - /// used by other [dependencies] Types. | 79 | + /// of the same `Type<S>` the [tag] does **not** conflict with the same tags |
80 | + /// used by other dependencies Types. | ||
81 | /// - [permanent] keeps the Instance in memory and persist it, | 81 | /// - [permanent] keeps the Instance in memory and persist it, |
82 | - /// not following [Get.smartManagement] | ||
83 | - /// rules. Although, can be removed by [GetInstance.reset()] | ||
84 | - /// and [Get.delete()] | 82 | + /// not following `Get.smartManagement` |
83 | + /// rules. Although, can be removed by `GetInstance.reset()` | ||
84 | + /// and `Get.delete()` | ||
85 | /// - [builder] If defined, the [dependency] must be returned from here | 85 | /// - [builder] If defined, the [dependency] must be returned from here |
86 | S put<S>(S dependency, | 86 | S put<S>(S dependency, |
87 | {String? tag, | 87 | {String? tag, |
@@ -92,25 +92,25 @@ extension Inst on GetInterface { | @@ -92,25 +92,25 @@ extension Inst on GetInterface { | ||
92 | /// Clears all registered instances (and/or tags). | 92 | /// Clears all registered instances (and/or tags). |
93 | /// Even the persistent ones. | 93 | /// Even the persistent ones. |
94 | /// | 94 | /// |
95 | - /// - [clearFactory] clears the callbacks registered by [Get.lazyPut()] | 95 | + /// - [clearFactory] clears the callbacks registered by `Get.lazyPut()` |
96 | /// - [clearRouteBindings] clears Instances associated with Routes when using | 96 | /// - [clearRouteBindings] clears Instances associated with Routes when using |
97 | /// [GetMaterialApp]. | 97 | /// [GetMaterialApp]. |
98 | bool reset({bool clearFactory = true, bool clearRouteBindings = true}) => | 98 | bool reset({bool clearFactory = true, bool clearRouteBindings = true}) => |
99 | GetInstance().reset( | 99 | GetInstance().reset( |
100 | clearFactory: clearFactory, clearRouteBindings: clearRouteBindings); | 100 | clearFactory: clearFactory, clearRouteBindings: clearRouteBindings); |
101 | 101 | ||
102 | - /// Deletes the Instance<[S]>, cleaning the memory and closes any open | ||
103 | - /// controllers ([DisposableInterface]). | 102 | + /// Deletes the `Instance<S>`, cleaning the memory and closes any open |
103 | + /// controllers (`DisposableInterface`). | ||
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 | /// Deletes all Instances, cleaning the memory and closes any open | 110 | /// Deletes all Instances, cleaning the memory and closes any open |
111 | - /// controllers ([DisposableInterface]). | 111 | + /// controllers (`DisposableInterface`). |
112 | /// | 112 | /// |
113 | - /// - [force] Will delete the Instances even if marked as [permanent]. | 113 | + /// - [force] Will delete the Instances even if marked as `permanent`. |
114 | Future<void> deleteAll({bool force = false}) async => | 114 | Future<void> deleteAll({bool force = false}) async => |
115 | GetInstance().deleteAll(force: force); | 115 | GetInstance().deleteAll(force: force); |
116 | 116 | ||
@@ -119,13 +119,13 @@ extension Inst on GetInterface { | @@ -119,13 +119,13 @@ extension Inst on GetInterface { | ||
119 | void reload<S>({String? tag, String? key, bool force = false}) => | 119 | void reload<S>({String? tag, String? key, bool force = false}) => |
120 | GetInstance().reload<S>(tag: tag, key: key, force: force); | 120 | GetInstance().reload<S>(tag: tag, key: key, force: force); |
121 | 121 | ||
122 | - /// Checks if a Class Instance<[S]> (or [tag]) is registered in memory. | 122 | + /// Checks if a Class `Instance<S>` (or [tag]) is registered in memory. |
123 | /// - [tag] optional, if you use a [tag] to register the Instance. | 123 | /// - [tag] optional, if you use a [tag] to register the Instance. |
124 | bool isRegistered<S>({String? tag}) => | 124 | bool isRegistered<S>({String? tag}) => |
125 | GetInstance().isRegistered<S>(tag: tag); | 125 | GetInstance().isRegistered<S>(tag: tag); |
126 | 126 | ||
127 | - /// Checks if an Instance<[S]> (or [tag]) returned from a factory builder | ||
128 | - /// [Get.lazyPut()], is registered in memory. | 127 | + /// Checks if an `Instance<S>` (or [tag]) returned from a factory builder |
128 | + /// `Get.lazyPut()`, is registered in memory. | ||
129 | /// - [tag] optional, if you use a [tag] to register the Instance. | 129 | /// - [tag] optional, if you use a [tag] to register the Instance. |
130 | bool isPrepared<S>({String? tag}) => GetInstance().isPrepared<S>(tag: tag); | 130 | bool isPrepared<S>({String? tag}) => GetInstance().isPrepared<S>(tag: tag); |
131 | } | 131 | } |
@@ -31,19 +31,19 @@ class GetInstance { | @@ -31,19 +31,19 @@ class GetInstance { | ||
31 | T call<T>() => find<T>(); | 31 | T call<T>() => find<T>(); |
32 | 32 | ||
33 | /// Holds references to every registered Instance when using | 33 | /// Holds references to every registered Instance when using |
34 | - /// [Get.put()] | 34 | + /// `Get.put()` |
35 | static final Map<String, _InstanceBuilderFactory> _singl = {}; | 35 | static final Map<String, _InstanceBuilderFactory> _singl = {}; |
36 | 36 | ||
37 | /// Holds a reference to every registered callback when using | 37 | /// Holds a reference to every registered callback when using |
38 | - /// [Get.lazyPut()] | 38 | + /// `Get.lazyPut()` |
39 | // static final Map<String, _Lazy> _factory = {}; | 39 | // static final Map<String, _Lazy> _factory = {}; |
40 | 40 | ||
41 | - /// Holds a reference to [Get.reference] when the Instance was | 41 | + /// Holds a reference to `Get.reference` when the Instance was |
42 | /// created to manage the memory. | 42 | /// created to manage the memory. |
43 | static final Map<String, String?> _routesKey = {}; | 43 | static final Map<String, String?> _routesKey = {}; |
44 | 44 | ||
45 | - /// Stores the onClose() references of instances created with [Get.create()] | ||
46 | - /// using the [Get.reference]. | 45 | + /// Stores the onClose() references of instances created with `Get.create()` |
46 | + /// using the `Get.reference`. | ||
47 | /// Experimental feature to keep the lifecycle and memory management with | 47 | /// Experimental feature to keep the lifecycle and memory management with |
48 | /// non-singleton instances. | 48 | /// non-singleton instances. |
49 | static final Map<String?, HashSet<Function>> _routesByCreate = {}; | 49 | static final Map<String?, HashSet<Function>> _routesByCreate = {}; |
@@ -66,8 +66,8 @@ class GetInstance { | @@ -66,8 +66,8 @@ class GetInstance { | ||
66 | ); | 66 | ); |
67 | } | 67 | } |
68 | 68 | ||
69 | - /// async version of [Get.put()]. | ||
70 | - /// Awaits for the resolution of the Future from [builder()] parameter and | 69 | + /// async version of `Get.put()`. |
70 | + /// Awaits for the resolution of the Future from `builder()` parameter and | ||
71 | /// stores the Instance returned. | 71 | /// stores the Instance returned. |
72 | Future<S> putAsync<S>( | 72 | Future<S> putAsync<S>( |
73 | AsyncInstanceBuilderCallback<S> builder, { | 73 | AsyncInstanceBuilderCallback<S> builder, { |
@@ -77,16 +77,16 @@ class GetInstance { | @@ -77,16 +77,16 @@ class GetInstance { | ||
77 | return put<S>(await builder(), tag: tag, permanent: permanent); | 77 | return put<S>(await builder(), tag: tag, permanent: permanent); |
78 | } | 78 | } |
79 | 79 | ||
80 | - /// Injects an instance <[S]> in memory to be globally accessible. | 80 | + /// Injects an instance `<S>` in memory to be globally accessible. |
81 | /// | 81 | /// |
82 | - /// No need to define the generic type <[S]> as it's inferred from | 82 | + /// No need to define the generic type `<S>` as it's inferred from |
83 | /// the [dependency] | 83 | /// the [dependency] |
84 | /// | 84 | /// |
85 | /// - [dependency] The Instance to be injected. | 85 | /// - [dependency] The Instance to be injected. |
86 | /// - [tag] optionally, use a [tag] as an "id" to create multiple records of | 86 | /// - [tag] optionally, use a [tag] as an "id" to create multiple records of |
87 | /// the same Type<[S]> | 87 | /// the same Type<[S]> |
88 | /// - [permanent] keeps the Instance in memory, not following | 88 | /// - [permanent] keeps the Instance in memory, not following |
89 | - /// [Get.smartManagement] rules. | 89 | + /// `Get.smartManagement` rules. |
90 | S put<S>( | 90 | S put<S>( |
91 | S dependency, { | 91 | S dependency, { |
92 | String? tag, | 92 | String? tag, |
@@ -101,27 +101,27 @@ class GetInstance { | @@ -101,27 +101,27 @@ class GetInstance { | ||
101 | return find<S>(tag: tag); | 101 | return find<S>(tag: tag); |
102 | } | 102 | } |
103 | 103 | ||
104 | - /// Creates a new Instance<S> lazily from the [<S>builder()] callback. | 104 | + /// Creates a new Instance<S> lazily from the `<S>builder()` callback. |
105 | /// | 105 | /// |
106 | - /// The first time you call [Get.find()], the [builder()] callback will create | 106 | + /// The first time you call `Get.find()`, the `builder()` callback will create |
107 | /// the Instance and persisted as a Singleton (like you would | 107 | /// the Instance and persisted as a Singleton (like you would |
108 | - /// use [Get.put()]). | 108 | + /// use `Get.put()`). |
109 | /// | 109 | /// |
110 | - /// Using [Get.smartManagement] as [SmartManagement.keepFactory] has | ||
111 | - /// the same outcome as using [fenix:true] : | ||
112 | - /// The internal register of [builder()] will remain in memory to recreate | ||
113 | - /// the Instance if the Instance has been removed with [Get.delete()]. | ||
114 | - /// Therefore, future calls to [Get.find()] will return the same Instance. | 110 | + /// Using `Get.smartManagement` as [SmartManagement.keepFactory] has |
111 | + /// the same outcome as using `fenix:true` : | ||
112 | + /// The internal register of `builder()` will remain in memory to recreate | ||
113 | + /// the Instance if the Instance has been removed with `Get.delete()`. | ||
114 | + /// Therefore, future calls to `Get.find()` will return the same Instance. | ||
115 | /// | 115 | /// |
116 | /// If you need to make use of GetxController's life-cycle | 116 | /// If you need to make use of GetxController's life-cycle |
117 | - /// ([onInit(), onStart(), onClose()]) [fenix] is a great choice to mix with | ||
118 | - /// [GetBuilder()] and [GetX()] widgets, and/or [GetMaterialApp] Navigation. | 117 | + /// (`onInit(), onStart(), onClose()`) [fenix] is a great choice to mix with |
118 | + /// `GetBuilder()` and `GetX()` widgets, and/or `GetMaterialApp` Navigation. | ||
119 | /// | 119 | /// |
120 | - /// You could use [Get.lazyPut(fenix:true)] in your app's [main()] instead | ||
121 | - /// of [Bindings()] for each [GetPage]. | 120 | + /// You could use `Get.lazyPut(fenix:true)` in your app's `main()` instead |
121 | + /// of `Bindings()` for each `GetPage`. | ||
122 | /// And the memory management will be similar. | 122 | /// And the memory management will be similar. |
123 | /// | 123 | /// |
124 | - /// Subsequent calls to [Get.lazyPut()] with the same parameters | 124 | + /// Subsequent calls to `Get.lazyPut()` with the same parameters |
125 | /// (<[S]> and optionally [tag] will **not** override the original). | 125 | /// (<[S]> and optionally [tag] will **not** override the original). |
126 | void lazyPut<S>( | 126 | void lazyPut<S>( |
127 | InstanceBuilderCallback<S> builder, { | 127 | InstanceBuilderCallback<S> builder, { |
@@ -141,11 +141,11 @@ class GetInstance { | @@ -141,11 +141,11 @@ class GetInstance { | ||
141 | /// Creates a new Class Instance [S] from the builder callback[S]. | 141 | /// Creates a new Class Instance [S] from the builder callback[S]. |
142 | /// Every time [find]<[S]>() is used, it calls the builder method to generate | 142 | /// Every time [find]<[S]>() is used, it calls the builder method to generate |
143 | /// a new Instance [S]. | 143 | /// a new Instance [S]. |
144 | - /// It also registers each [instance.onClose()] with the current | ||
145 | - /// Route [Get.reference] to keep the lifecycle active. | 144 | + /// It also registers each `instance.onClose()` with the current |
145 | + /// Route `Get.reference` to keep the lifecycle active. | ||
146 | /// Is important to know that the instances created are only stored per Route. | 146 | /// Is important to know that the instances created are only stored per Route. |
147 | /// So, if you call `Get.delete<T>()` the "instance factory" used in this | 147 | /// So, if you call `Get.delete<T>()` the "instance factory" used in this |
148 | - /// method ([Get.create<T>()]) will be removed, but NOT the instances | 148 | + /// method (`Get.create<T>()`) will be removed, but NOT the instances |
149 | /// already created by it. | 149 | /// already created by it. |
150 | /// | 150 | /// |
151 | /// Example: | 151 | /// Example: |
@@ -167,7 +167,7 @@ class GetInstance { | @@ -167,7 +167,7 @@ class GetInstance { | ||
167 | ); | 167 | ); |
168 | } | 168 | } |
169 | 169 | ||
170 | - /// Injects the Instance [S] builder into the [_singleton] HashMap. | 170 | + /// Injects the Instance [S] builder into the `_singleton` HashMap. |
171 | void _insert<S>({ | 171 | void _insert<S>({ |
172 | bool? isSingleton, | 172 | bool? isSingleton, |
173 | String? name, | 173 | String? name, |
@@ -190,9 +190,9 @@ class GetInstance { | @@ -190,9 +190,9 @@ class GetInstance { | ||
190 | } | 190 | } |
191 | 191 | ||
192 | /// Clears from memory registered Instances associated with [routeName] when | 192 | /// Clears from memory registered Instances associated with [routeName] when |
193 | - /// using [Get.smartManagement] as [SmartManagement.full] or | 193 | + /// using `Get.smartManagement` as [SmartManagement.full] or |
194 | /// [SmartManagement.keepFactory] | 194 | /// [SmartManagement.keepFactory] |
195 | - /// Meant for internal usage of [GetPageRoute] and [GetDialogRoute] | 195 | + /// Meant for internal usage of `GetPageRoute` and `GetDialogRoute` |
196 | void removeDependencyByRoute(String routeName) { | 196 | void removeDependencyByRoute(String routeName) { |
197 | final keysToRemove = <String>[]; | 197 | final keysToRemove = <String>[]; |
198 | _routesKey.forEach((key, value) { | 198 | _routesKey.forEach((key, value) { |
@@ -201,11 +201,11 @@ class GetInstance { | @@ -201,11 +201,11 @@ class GetInstance { | ||
201 | } | 201 | } |
202 | }); | 202 | }); |
203 | 203 | ||
204 | - /// Removes [Get.create()] instances registered in [routeName]. | 204 | + /// Removes `Get.create()` instances registered in `routeName`. |
205 | if (_routesByCreate.containsKey(routeName)) { | 205 | if (_routesByCreate.containsKey(routeName)) { |
206 | for (final onClose in _routesByCreate[routeName]!) { | 206 | for (final onClose in _routesByCreate[routeName]!) { |
207 | // assure the [DisposableInterface] instance holding a reference | 207 | // assure the [DisposableInterface] instance holding a reference |
208 | - // to [onClose()] wasn't disposed. | 208 | + // to onClose() wasn't disposed. |
209 | onClose(); | 209 | onClose(); |
210 | } | 210 | } |
211 | _routesByCreate[routeName]!.clear(); | 211 | _routesByCreate[routeName]!.clear(); |
@@ -228,11 +228,11 @@ class GetInstance { | @@ -228,11 +228,11 @@ class GetInstance { | ||
228 | } | 228 | } |
229 | }); | 229 | }); |
230 | 230 | ||
231 | - /// Removes [Get.create()] instances registered in [routeName]. | 231 | + /// Removes `Get.create()` instances registered in `routeName`. |
232 | if (_routesByCreate.containsKey(routeName)) { | 232 | if (_routesByCreate.containsKey(routeName)) { |
233 | for (final onClose in _routesByCreate[routeName]!) { | 233 | for (final onClose in _routesByCreate[routeName]!) { |
234 | // assure the [DisposableInterface] instance holding a reference | 234 | // assure the [DisposableInterface] instance holding a reference |
235 | - // to [onClose()] wasn't disposed. | 235 | + // to onClose() wasn't disposed. |
236 | onClose(); | 236 | onClose(); |
237 | } | 237 | } |
238 | _routesByCreate[routeName]!.clear(); | 238 | _routesByCreate[routeName]!.clear(); |
@@ -250,8 +250,8 @@ class GetInstance { | @@ -250,8 +250,8 @@ class GetInstance { | ||
250 | /// Initializes the dependencies for a Class Instance [S] (or tag), | 250 | /// Initializes the dependencies for a Class Instance [S] (or tag), |
251 | /// If its a Controller, it starts the lifecycle process. | 251 | /// If its a Controller, it starts the lifecycle process. |
252 | /// Optionally associating the current Route to the lifetime of the instance, | 252 | /// Optionally associating the current Route to the lifetime of the instance, |
253 | - /// if [Get.smartManagement] is marked as [SmartManagement.full] or | ||
254 | - /// [Get.keepFactory] | 253 | + /// if `Get.smartManagement` is marked as [SmartManagement.full] or |
254 | + /// [SmartManagement.keepFactory] | ||
255 | /// Only flags `isInit` if it's using `Get.create()` | 255 | /// Only flags `isInit` if it's using `Get.create()` |
256 | /// (not for Singletons access). | 256 | /// (not for Singletons access). |
257 | /// Returns the instance if not initialized, required for Get.create() to | 257 | /// Returns the instance if not initialized, required for Get.create() to |
@@ -273,7 +273,7 @@ class GetInstance { | @@ -273,7 +273,7 @@ class GetInstance { | ||
273 | } | 273 | } |
274 | 274 | ||
275 | /// Links a Class instance [S] (or [tag]) to the current route. | 275 | /// Links a Class instance [S] (or [tag]) to the current route. |
276 | - /// Requires usage of [GetMaterialApp]. | 276 | + /// Requires usage of `GetMaterialApp`. |
277 | void _registerRouteInstance<S>({String? tag}) { | 277 | void _registerRouteInstance<S>({String? tag}) { |
278 | _routesKey.putIfAbsent(_getKey(S, tag), () => Get.reference); | 278 | _routesKey.putIfAbsent(_getKey(S, tag), () => Get.reference); |
279 | } | 279 | } |
@@ -378,7 +378,7 @@ class GetInstance { | @@ -378,7 +378,7 @@ class GetInstance { | ||
378 | } | 378 | } |
379 | 379 | ||
380 | /// Delete registered Class Instance [S] (or [tag]) and, closes any open | 380 | /// Delete registered Class Instance [S] (or [tag]) and, closes any open |
381 | - /// controllers [DisposableInterface], cleans up the memory | 381 | + /// controllers `DisposableInterface`, cleans up the memory |
382 | /// | 382 | /// |
383 | /// /// Deletes the Instance<[S]>, cleaning the memory. | 383 | /// /// Deletes the Instance<[S]>, cleaning the memory. |
384 | // /// | 384 | // /// |
@@ -387,12 +387,12 @@ class GetInstance { | @@ -387,12 +387,12 @@ class GetInstance { | ||
387 | // /// the Instance. **don't use** it unless you know what you are doing. | 387 | // /// the Instance. **don't use** it unless you know what you are doing. |
388 | 388 | ||
389 | /// Deletes the Instance<[S]>, cleaning the memory and closes any open | 389 | /// Deletes the Instance<[S]>, cleaning the memory and closes any open |
390 | - /// controllers ([DisposableInterface]). | 390 | + /// controllers (`DisposableInterface`). |
391 | /// | 391 | /// |
392 | /// - [tag] Optional "tag" used to register the Instance | 392 | /// - [tag] Optional "tag" used to register the Instance |
393 | /// - [key] For internal usage, is the processed key used to register | 393 | /// - [key] For internal usage, is the processed key used to register |
394 | /// the Instance. **don't use** it unless you know what you are doing. | 394 | /// the Instance. **don't use** it unless you know what you are doing. |
395 | - /// - [force] Will delete an Instance even if marked as [permanent]. | 395 | + /// - [force] Will delete an Instance even if marked as `permanent`. |
396 | bool delete<S>({String? tag, String? key, bool force = false}) { | 396 | bool delete<S>({String? tag, String? key, bool force = false}) { |
397 | final newKey = key ?? _getKey(S, tag); | 397 | final newKey = key ?? _getKey(S, tag); |
398 | 398 | ||
@@ -438,9 +438,9 @@ class GetInstance { | @@ -438,9 +438,9 @@ class GetInstance { | ||
438 | } | 438 | } |
439 | 439 | ||
440 | /// Delete all registered Class Instances and, closes any open | 440 | /// Delete all registered Class Instances and, closes any open |
441 | - /// controllers [DisposableInterface], cleans up the memory | 441 | + /// controllers `DisposableInterface`, cleans up the memory |
442 | /// | 442 | /// |
443 | - /// - [force] Will delete the Instances even if marked as [permanent]. | 443 | + /// - [force] Will delete the Instances even if marked as `permanent`. |
444 | void deleteAll({bool force = false}) { | 444 | void deleteAll({bool force = false}) { |
445 | _singl.forEach((key, value) { | 445 | _singl.forEach((key, value) { |
446 | delete(key: key, force: force); | 446 | delete(key: key, force: force); |
@@ -482,7 +482,7 @@ class GetInstance { | @@ -482,7 +482,7 @@ class GetInstance { | ||
482 | /// - [tag] is optional, if you used a [tag] to register the Instance. | 482 | /// - [tag] is optional, if you used a [tag] to register the Instance. |
483 | bool isRegistered<S>({String? tag}) => _singl.containsKey(_getKey(S, tag)); | 483 | bool isRegistered<S>({String? tag}) => _singl.containsKey(_getKey(S, tag)); |
484 | 484 | ||
485 | - /// Checks if a lazy factory callback ([Get.lazyPut()] that returns an | 485 | + /// Checks if a lazy factory callback `Get.lazyPut()` that returns an |
486 | /// Instance<[S]> is registered in memory. | 486 | /// Instance<[S]> is registered in memory. |
487 | /// - [tag] is optional, if you used a [tag] to register the lazy Instance. | 487 | /// - [tag] is optional, if you used a [tag] to register the lazy Instance. |
488 | bool isPrepared<S>({String? tag}) { | 488 | bool isPrepared<S>({String? tag}) { |
@@ -506,7 +506,7 @@ typedef InjectorBuilderCallback<S> = S Function(GetInstance); | @@ -506,7 +506,7 @@ typedef InjectorBuilderCallback<S> = S Function(GetInstance); | ||
506 | 506 | ||
507 | typedef AsyncInstanceBuilderCallback<S> = Future<S> Function(); | 507 | typedef AsyncInstanceBuilderCallback<S> = Future<S> Function(); |
508 | 508 | ||
509 | -/// Internal class to register instances with Get.[put]<[S]>(). | 509 | +/// Internal class to register instances with `Get.put<S>()`. |
510 | class _InstanceBuilderFactory<S> { | 510 | class _InstanceBuilderFactory<S> { |
511 | /// Marks the Builder as a single instance. | 511 | /// Marks the Builder as a single instance. |
512 | /// For reusing [dependency] instead of [builderFunc] | 512 | /// For reusing [dependency] instead of [builderFunc] |
@@ -524,7 +524,7 @@ class _InstanceBuilderFactory<S> { | @@ -524,7 +524,7 @@ class _InstanceBuilderFactory<S> { | ||
524 | InstanceBuilderCallback<S> builderFunc; | 524 | InstanceBuilderCallback<S> builderFunc; |
525 | 525 | ||
526 | /// Flag to persist the instance in memory, | 526 | /// Flag to persist the instance in memory, |
527 | - /// without considering [Get.smartManagement] | 527 | + /// without considering `Get.smartManagement` |
528 | bool permanent = false; | 528 | bool permanent = false; |
529 | 529 | ||
530 | bool isInit = false; | 530 | bool isInit = false; |
@@ -3,7 +3,7 @@ import '../../get_core/get_core.dart'; | @@ -3,7 +3,7 @@ import '../../get_core/get_core.dart'; | ||
3 | /// Special callable class to keep the contract of a regular method, and avoid | 3 | /// Special callable class to keep the contract of a regular method, and avoid |
4 | /// overrides if you extend the class that uses it, as Dart has no final | 4 | /// overrides if you extend the class that uses it, as Dart has no final |
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 |
@@ -510,7 +510,7 @@ extension ExtensionBottomSheet on GetInterface { | @@ -510,7 +510,7 @@ extension ExtensionBottomSheet on GetInterface { | ||
510 | extension GetNavigation on GetInterface { | 510 | extension GetNavigation on GetInterface { |
511 | /// **Navigation.push()** shortcut.<br><br> | 511 | /// **Navigation.push()** shortcut.<br><br> |
512 | /// | 512 | /// |
513 | - /// Pushes a new [page] to the stack | 513 | + /// Pushes a new `page` to the stack |
514 | /// | 514 | /// |
515 | /// It has the advantage of not needing context, | 515 | /// It has the advantage of not needing context, |
516 | /// so you can call from your business logic | 516 | /// so you can call from your business logic |
@@ -590,7 +590,7 @@ you can only use widgets and widget functions here'''; | @@ -590,7 +590,7 @@ you can only use widgets and widget functions here'''; | ||
590 | 590 | ||
591 | /// **Navigation.pushNamed()** shortcut.<br><br> | 591 | /// **Navigation.pushNamed()** shortcut.<br><br> |
592 | /// | 592 | /// |
593 | - /// Pushes a new named [page] to the stack. | 593 | + /// Pushes a new named `page` to the stack. |
594 | /// | 594 | /// |
595 | /// It has the advantage of not needing context, so you can call | 595 | /// It has the advantage of not needing context, so you can call |
596 | /// from your business logic. | 596 | /// from your business logic. |
@@ -628,7 +628,7 @@ you can only use widgets and widget functions here'''; | @@ -628,7 +628,7 @@ you can only use widgets and widget functions here'''; | ||
628 | 628 | ||
629 | /// **Navigation.pushReplacementNamed()** shortcut.<br><br> | 629 | /// **Navigation.pushReplacementNamed()** shortcut.<br><br> |
630 | /// | 630 | /// |
631 | - /// Pop the current named [page] in the stack and push a new one in its place | 631 | + /// Pop the current named `page` in the stack and push a new one in its place |
632 | /// | 632 | /// |
633 | /// It has the advantage of not needing context, so you can call | 633 | /// It has the advantage of not needing context, so you can call |
634 | /// from your business logic. | 634 | /// from your business logic. |
@@ -684,7 +684,7 @@ you can only use widgets and widget functions here'''; | @@ -684,7 +684,7 @@ you can only use widgets and widget functions here'''; | ||
684 | 684 | ||
685 | /// **Navigation.pushAndRemoveUntil()** shortcut.<br><br> | 685 | /// **Navigation.pushAndRemoveUntil()** shortcut.<br><br> |
686 | /// | 686 | /// |
687 | - /// Push the given [page], and then pop several pages in the stack until | 687 | + /// Push the given `page`, and then pop several pages in the stack until |
688 | /// [predicate] returns true | 688 | /// [predicate] returns true |
689 | /// | 689 | /// |
690 | /// [id] is for when you are using nested navigation, | 690 | /// [id] is for when you are using nested navigation, |
@@ -708,7 +708,7 @@ you can only use widgets and widget functions here'''; | @@ -708,7 +708,7 @@ you can only use widgets and widget functions here'''; | ||
708 | 708 | ||
709 | /// **Navigation.pushNamedAndRemoveUntil()** shortcut.<br><br> | 709 | /// **Navigation.pushNamedAndRemoveUntil()** shortcut.<br><br> |
710 | /// | 710 | /// |
711 | - /// Push the given named [page], and then pop several pages in the stack | 711 | + /// Push the given named `page`, and then pop several pages in the stack |
712 | /// until [predicate] returns true | 712 | /// until [predicate] returns true |
713 | /// | 713 | /// |
714 | /// You can send any type of value to the other route in the [arguments]. | 714 | /// You can send any type of value to the other route in the [arguments]. |
@@ -745,7 +745,7 @@ you can only use widgets and widget functions here'''; | @@ -745,7 +745,7 @@ you can only use widgets and widget functions here'''; | ||
745 | 745 | ||
746 | /// **Navigation.popAndPushNamed()** shortcut.<br><br> | 746 | /// **Navigation.popAndPushNamed()** shortcut.<br><br> |
747 | /// | 747 | /// |
748 | - /// Pop the current named page and pushes a new [page] to the stack | 748 | + /// Pop the current named page and pushes a new `page` to the stack |
749 | /// in its place | 749 | /// in its place |
750 | /// | 750 | /// |
751 | /// You can send any type of value to the other route in the [arguments]. | 751 | /// You can send any type of value to the other route in the [arguments]. |
@@ -784,7 +784,7 @@ you can only use widgets and widget functions here'''; | @@ -784,7 +784,7 @@ you can only use widgets and widget functions here'''; | ||
784 | 784 | ||
785 | /// **Navigation.pushNamedAndRemoveUntil()** shortcut.<br><br> | 785 | /// **Navigation.pushNamedAndRemoveUntil()** shortcut.<br><br> |
786 | /// | 786 | /// |
787 | - /// Push a named [page] and pop several pages in the stack | 787 | + /// Push a named `page` and pop several pages in the stack |
788 | /// until [predicate] returns true. [predicate] is optional | 788 | /// until [predicate] returns true. [predicate] is optional |
789 | /// | 789 | /// |
790 | /// It has the advantage of not needing context, so you can | 790 | /// It has the advantage of not needing context, so you can |
@@ -879,7 +879,7 @@ you can only use widgets and widget functions here'''; | @@ -879,7 +879,7 @@ you can only use widgets and widget functions here'''; | ||
879 | 879 | ||
880 | /// **Navigation.pushReplacement()** shortcut .<br><br> | 880 | /// **Navigation.pushReplacement()** shortcut .<br><br> |
881 | /// | 881 | /// |
882 | - /// Pop the current page and pushes a new [page] to the stack | 882 | + /// Pop the current page and pushes a new `page` to the stack |
883 | /// | 883 | /// |
884 | /// It has the advantage of not needing context, | 884 | /// It has the advantage of not needing context, |
885 | /// so you can call from your business logic | 885 | /// so you can call from your business logic |
@@ -936,7 +936,7 @@ you can only use widgets and widget functions here'''; | @@ -936,7 +936,7 @@ you can only use widgets and widget functions here'''; | ||
936 | 936 | ||
937 | /// **Navigation.pushAndRemoveUntil()** shortcut .<br><br> | 937 | /// **Navigation.pushAndRemoveUntil()** shortcut .<br><br> |
938 | /// | 938 | /// |
939 | - /// Push a [page] and pop several pages in the stack | 939 | + /// Push a `page` and pop several pages in the stack |
940 | /// until [predicate] returns true. [predicate] is optional | 940 | /// until [predicate] returns true. [predicate] is optional |
941 | /// | 941 | /// |
942 | /// It has the advantage of not needing context, | 942 | /// It has the advantage of not needing context, |
@@ -2,6 +2,22 @@ import 'package:flutter/widgets.dart'; | @@ -2,6 +2,22 @@ import 'package:flutter/widgets.dart'; | ||
2 | 2 | ||
3 | import '../../../get.dart'; | 3 | import '../../../get.dart'; |
4 | 4 | ||
5 | +// class GetRouterState extends GetxController { | ||
6 | +// GetRouterState({required this.currentTreeBranch}); | ||
7 | +// final List<GetPage> currentTreeBranch; | ||
8 | +// GetPage? get currentPage => currentTreeBranch.last; | ||
9 | + | ||
10 | +// static GetNavConfig? fromRoute(String route) { | ||
11 | +// final res = Get.routeTree.matchRoute(route); | ||
12 | +// if (res.treeBranch.isEmpty) return null; | ||
13 | +// return GetNavConfig( | ||
14 | +// currentTreeBranch: res.treeBranch, | ||
15 | +// location: route, | ||
16 | +// state: null, | ||
17 | +// ); | ||
18 | +// } | ||
19 | +// } | ||
20 | + | ||
5 | /// This config enables us to navigate directly to a sub-url | 21 | /// This config enables us to navigate directly to a sub-url |
6 | class GetNavConfig extends RouteInformation { | 22 | class GetNavConfig extends RouteInformation { |
7 | final List<GetPage> currentTreeBranch; | 23 | final List<GetPage> currentTreeBranch; |
@@ -18,7 +34,6 @@ class GetNavConfig extends RouteInformation { | @@ -18,7 +34,6 @@ class GetNavConfig extends RouteInformation { | ||
18 | 34 | ||
19 | GetNavConfig copyWith({ | 35 | GetNavConfig copyWith({ |
20 | List<GetPage>? currentTreeBranch, | 36 | List<GetPage>? currentTreeBranch, |
21 | - GetPage? currentPage, | ||
22 | required String? location, | 37 | required String? location, |
23 | required Object? state, | 38 | required Object? state, |
24 | }) { | 39 | }) { |
@@ -108,6 +108,10 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | @@ -108,6 +108,10 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | ||
108 | return history.removeAt(index); | 108 | return history.removeAt(index); |
109 | } | 109 | } |
110 | 110 | ||
111 | + T arguments<T>() { | ||
112 | + return currentConfiguration?.currentPage?.arguments as T; | ||
113 | + } | ||
114 | + | ||
111 | // void _unsafeHistoryClear() { | 115 | // void _unsafeHistoryClear() { |
112 | // history.clear(); | 116 | // history.clear(); |
113 | // } | 117 | // } |
@@ -255,9 +259,6 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | @@ -255,9 +259,6 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | ||
255 | } | 259 | } |
256 | 260 | ||
257 | /// gets the visual pages from the current history entry | 261 | /// gets the visual pages from the current history entry |
258 | - /// | ||
259 | - /// visual pages must have the [RouterOutletContainerMiddleWare] middleware | ||
260 | - /// with `stayAt` equal to the route name of the visual page | ||
261 | List<GetPage> getVisualPages() { | 262 | List<GetPage> getVisualPages() { |
262 | final currentHistory = currentConfiguration; | 263 | final currentHistory = currentConfiguration; |
263 | if (currentHistory == null) return <GetPage>[]; | 264 | if (currentHistory == null) return <GetPage>[]; |
@@ -266,7 +267,7 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | @@ -266,7 +267,7 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | ||
266 | .where((r) => r.participatesInRootNavigator != null); | 267 | .where((r) => r.participatesInRootNavigator != null); |
267 | if (res.length == 0) { | 268 | if (res.length == 0) { |
268 | //default behavoir, all routes participate in root navigator | 269 | //default behavoir, all routes participate in root navigator |
269 | - return currentHistory.currentTreeBranch; | 270 | + return history.map((e) => e.currentPage!).toList(); |
270 | } else { | 271 | } else { |
271 | //user specified at least one participatesInRootNavigator | 272 | //user specified at least one participatesInRootNavigator |
272 | return res | 273 | return res |
@@ -312,21 +313,33 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | @@ -312,21 +313,33 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | ||
312 | return route; | 313 | return route; |
313 | } | 314 | } |
314 | 315 | ||
315 | - Future<T?> toNamed<T>(String fullRoute) { | ||
316 | - final decoder = Get.routeTree.matchRoute(fullRoute); | 316 | + Future<T?> toNamed<T>( |
317 | + String page, { | ||
318 | + dynamic arguments, | ||
319 | + Map<String, String>? parameters, | ||
320 | + }) { | ||
321 | + if (parameters != null) { | ||
322 | + final uri = Uri(path: page, queryParameters: parameters); | ||
323 | + page = uri.toString(); | ||
324 | + } | ||
325 | + | ||
326 | + final decoder = Get.routeTree.matchRoute(page, arguments: arguments); | ||
327 | + Get.parameters = decoder.parameters; | ||
328 | + decoder.replaceArguments(arguments); | ||
317 | 329 | ||
318 | return pushHistory<T>( | 330 | return pushHistory<T>( |
319 | GetNavConfig( | 331 | GetNavConfig( |
320 | currentTreeBranch: decoder.treeBranch, | 332 | currentTreeBranch: decoder.treeBranch, |
321 | - location: fullRoute, | 333 | + location: page, |
322 | state: null, //TODO: persist state? | 334 | state: null, //TODO: persist state? |
323 | ), | 335 | ), |
324 | ); | 336 | ); |
325 | } | 337 | } |
326 | 338 | ||
327 | - Future<T?> offNamed<T>(String fullRoute) async { | 339 | + Future<T?> offNamed<T>(String page, |
340 | + {dynamic arguments, Map<String, String>? parameters}) async { | ||
328 | await popHistory(); | 341 | await popHistory(); |
329 | - return await toNamed(fullRoute); | 342 | + return await toNamed(page, arguments: arguments, parameters: parameters); |
330 | } | 343 | } |
331 | 344 | ||
332 | /// Removes routes according to [PopMode] | 345 | /// Removes routes according to [PopMode] |
@@ -337,7 +350,6 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | @@ -337,7 +350,6 @@ class GetDelegate extends RouterDelegate<GetNavConfig> | ||
337 | PopMode popMode = PopMode.Page, | 350 | PopMode popMode = PopMode.Page, |
338 | }) { | 351 | }) { |
339 | // remove history or page entries until you meet route | 352 | // remove history or page entries until you meet route |
340 | - | ||
341 | var iterator = currentConfiguration; | 353 | var iterator = currentConfiguration; |
342 | while (_canPop(popMode) && | 354 | while (_canPop(popMode) && |
343 | iterator != null && | 355 | iterator != null && |
@@ -172,6 +172,7 @@ class GetMaterialApp extends StatelessWidget { | @@ -172,6 +172,7 @@ class GetMaterialApp extends StatelessWidget { | ||
172 | this.transitionDuration, | 172 | this.transitionDuration, |
173 | this.defaultGlobalState, | 173 | this.defaultGlobalState, |
174 | this.getPages, | 174 | this.getPages, |
175 | + this.navigatorObservers, | ||
175 | this.unknownRoute, | 176 | this.unknownRoute, |
176 | }) : routerDelegate = routerDelegate ??= Get.createDelegate( | 177 | }) : routerDelegate = routerDelegate ??= Get.createDelegate( |
177 | notFoundRoute: unknownRoute, | 178 | notFoundRoute: unknownRoute, |
@@ -180,7 +181,7 @@ class GetMaterialApp extends StatelessWidget { | @@ -180,7 +181,7 @@ class GetMaterialApp extends StatelessWidget { | ||
180 | routeInformationParser ??= Get.createInformationParser( | 181 | routeInformationParser ??= Get.createInformationParser( |
181 | initialRoute: getPages?.first.name ?? '/', | 182 | initialRoute: getPages?.first.name ?? '/', |
182 | ), | 183 | ), |
183 | - navigatorObservers = null, | 184 | + //navigatorObservers = null, |
184 | navigatorKey = null, | 185 | navigatorKey = null, |
185 | onGenerateRoute = null, | 186 | onGenerateRoute = null, |
186 | home = null, | 187 | home = null, |
@@ -5,10 +5,19 @@ class RouteDecoder { | @@ -5,10 +5,19 @@ class RouteDecoder { | ||
5 | final List<GetPage> treeBranch; | 5 | final List<GetPage> treeBranch; |
6 | GetPage? get route => treeBranch.isEmpty ? null : treeBranch.last; | 6 | GetPage? get route => treeBranch.isEmpty ? null : treeBranch.last; |
7 | final Map<String, String> parameters; | 7 | final Map<String, String> parameters; |
8 | + final Object? arguments; | ||
8 | const RouteDecoder( | 9 | const RouteDecoder( |
9 | this.treeBranch, | 10 | this.treeBranch, |
10 | this.parameters, | 11 | this.parameters, |
12 | + this.arguments, | ||
11 | ); | 13 | ); |
14 | + void replaceArguments(Object? arguments) { | ||
15 | + final _route = route; | ||
16 | + if (_route != null) { | ||
17 | + final index = treeBranch.indexOf(_route); | ||
18 | + treeBranch[index] = _route.copy(arguments: arguments); | ||
19 | + } | ||
20 | + } | ||
12 | } | 21 | } |
13 | 22 | ||
14 | class ParseRouteTree { | 23 | class ParseRouteTree { |
@@ -18,7 +27,7 @@ class ParseRouteTree { | @@ -18,7 +27,7 @@ class ParseRouteTree { | ||
18 | 27 | ||
19 | final List<GetPage> routes; | 28 | final List<GetPage> routes; |
20 | 29 | ||
21 | - RouteDecoder matchRoute(String name) { | 30 | + RouteDecoder matchRoute(String name, {Object? arguments}) { |
22 | final uri = Uri.parse(name); | 31 | final uri = Uri.parse(name); |
23 | // /home/profile/123 => home,profile,123 => /,/home,/home/profile,/home/profile/123 | 32 | // /home/profile/123 => home,profile,123 => /,/home,/home/profile,/home/profile/123 |
24 | final split = uri.path.split('/').where((element) => element.isNotEmpty); | 33 | final split = uri.path.split('/').where((element) => element.isNotEmpty); |
@@ -64,6 +73,7 @@ class ParseRouteTree { | @@ -64,6 +73,7 @@ class ParseRouteTree { | ||
64 | return RouteDecoder( | 73 | return RouteDecoder( |
65 | mappedTreeBranch, | 74 | mappedTreeBranch, |
66 | params, | 75 | params, |
76 | + arguments, | ||
67 | ); | 77 | ); |
68 | } | 78 | } |
69 | 79 | ||
@@ -71,6 +81,7 @@ class ParseRouteTree { | @@ -71,6 +81,7 @@ class ParseRouteTree { | ||
71 | return RouteDecoder( | 81 | return RouteDecoder( |
72 | treeBranch.map((e) => e.value).toList(), | 82 | treeBranch.map((e) => e.value).toList(), |
73 | params, | 83 | params, |
84 | + arguments, | ||
74 | ); | 85 | ); |
75 | } | 86 | } |
76 | 87 |
@@ -52,7 +52,7 @@ class GetPage<T> extends Page<T> { | @@ -52,7 +52,7 @@ class GetPage<T> extends Page<T> { | ||
52 | // RouteSettings get settings => this; | 52 | // RouteSettings get settings => this; |
53 | 53 | ||
54 | @override | 54 | @override |
55 | - Object? get arguments => Get.arguments; | 55 | + final Object? arguments; |
56 | 56 | ||
57 | @override | 57 | @override |
58 | final String name; | 58 | final String name; |
@@ -84,6 +84,7 @@ class GetPage<T> extends Page<T> { | @@ -84,6 +84,7 @@ class GetPage<T> extends Page<T> { | ||
84 | this.children = const <GetPage>[], | 84 | this.children = const <GetPage>[], |
85 | this.middlewares, | 85 | this.middlewares, |
86 | this.unknownRoute, | 86 | this.unknownRoute, |
87 | + this.arguments, | ||
87 | this.preventDuplicates = true, | 88 | this.preventDuplicates = true, |
88 | }) : path = _nameToRegex(name), | 89 | }) : path = _nameToRegex(name), |
89 | super( | 90 | super( |
@@ -137,6 +138,7 @@ class GetPage<T> extends Page<T> { | @@ -137,6 +138,7 @@ class GetPage<T> extends Page<T> { | ||
137 | bool? preventDuplicates, | 138 | bool? preventDuplicates, |
138 | double? gestureWidth, | 139 | double? gestureWidth, |
139 | bool? participatesInRootNavigator, | 140 | bool? participatesInRootNavigator, |
141 | + Object? arguments, | ||
140 | }) { | 142 | }) { |
141 | return GetPage( | 143 | return GetPage( |
142 | participatesInRootNavigator: | 144 | participatesInRootNavigator: |
@@ -161,6 +163,7 @@ class GetPage<T> extends Page<T> { | @@ -161,6 +163,7 @@ class GetPage<T> extends Page<T> { | ||
161 | unknownRoute: unknownRoute ?? this.unknownRoute, | 163 | unknownRoute: unknownRoute ?? this.unknownRoute, |
162 | middlewares: middlewares ?? this.middlewares, | 164 | middlewares: middlewares ?? this.middlewares, |
163 | gestureWidth: gestureWidth ?? this.gestureWidth, | 165 | gestureWidth: gestureWidth ?? this.gestureWidth, |
166 | + arguments: arguments ?? this.arguments, | ||
164 | ); | 167 | ); |
165 | } | 168 | } |
166 | 169 |
@@ -186,7 +186,7 @@ class SnackRoute<T> extends OverlayRoute<T> { | @@ -186,7 +186,7 @@ class SnackRoute<T> extends OverlayRoute<T> { | ||
186 | 186 | ||
187 | /// Called to create the animation that exposes the current progress of | 187 | /// Called to create the animation that exposes the current progress of |
188 | /// the transition controlled by the animation controller created by | 188 | /// the transition controlled by the animation controller created by |
189 | - /// [createAnimationController()]. | 189 | + /// `createAnimationController()`. |
190 | Animation<Alignment> createAnimation() { | 190 | Animation<Alignment> createAnimation() { |
191 | assert(!_transitionCompleter.isCompleted, | 191 | assert(!_transitionCompleter.isCompleted, |
192 | 'Cannot reuse a $runtimeType after disposing it.'); | 192 | 'Cannot reuse a $runtimeType after disposing it.'); |
@@ -29,10 +29,10 @@ mixin RxObjectMixin<T> on NotifyManager<T> { | @@ -29,10 +29,10 @@ mixin RxObjectMixin<T> on NotifyManager<T> { | ||
29 | subject.add(value); | 29 | subject.add(value); |
30 | } | 30 | } |
31 | 31 | ||
32 | - /// updates the value to [null] and adds it to the Stream. | 32 | + /// updates the value to `null` and adds it to the Stream. |
33 | /// Even with null-safety coming, is still an important feature to support, as | 33 | /// Even with null-safety coming, is still an important feature to support, as |
34 | - /// [call()] doesn't accept [null] values. For instance, | ||
35 | - /// [InputDecoration.errorText] has to be null to not show the "error state". | 34 | + /// `call()` doesn't accept `null` values. For instance, |
35 | + /// `InputDecoration.errorText` has to be null to not show the "error state". | ||
36 | /// | 36 | /// |
37 | /// Sample: | 37 | /// Sample: |
38 | /// ``` | 38 | /// ``` |
@@ -44,7 +44,7 @@ mixin RxObjectMixin<T> on NotifyManager<T> { | @@ -44,7 +44,7 @@ mixin RxObjectMixin<T> on NotifyManager<T> { | ||
44 | // } | 44 | // } |
45 | 45 | ||
46 | /// Makes this Rx looks like a function so you can update a new | 46 | /// Makes this Rx looks like a function so you can update a new |
47 | - /// value using [rx(someOtherValue)]. Practical to assign the Rx directly | 47 | + /// value using `rx(someOtherValue)`. Practical to assign the Rx directly |
48 | /// to some Widget that has a signature ::onChange( value ) | 48 | /// to some Widget that has a signature ::onChange( value ) |
49 | /// | 49 | /// |
50 | /// Example: | 50 | /// Example: |
@@ -111,10 +111,10 @@ mixin RxObjectMixin<T> on NotifyManager<T> { | @@ -111,10 +111,10 @@ mixin RxObjectMixin<T> on NotifyManager<T> { | ||
111 | 111 | ||
112 | Stream<T?> get stream => subject.stream; | 112 | Stream<T?> get stream => subject.stream; |
113 | 113 | ||
114 | - /// Binds an existing [Stream<T>] to this Rx<T> to keep the values in sync. | 114 | + /// Binds an existing `Stream<T>` to this Rx<T> to keep the values in sync. |
115 | /// You can bind multiple sources to update the value. | 115 | /// You can bind multiple sources to update the value. |
116 | /// Closing the subscription will happen automatically when the observer | 116 | /// Closing the subscription will happen automatically when the observer |
117 | - /// Widget ([GetX] or [Obx]) gets unmounted from the Widget tree. | 117 | + /// Widget (`GetX` or `Obx`) gets unmounted from the Widget tree. |
118 | void bindStream(Stream<T> stream) { | 118 | void bindStream(Stream<T> stream) { |
119 | final listSubscriptions = | 119 | final listSubscriptions = |
120 | _subscriptions[subject] ??= <StreamSubscription>[]; | 120 | _subscriptions[subject] ??= <StreamSubscription>[]; |
@@ -2,7 +2,7 @@ part of rx_types; | @@ -2,7 +2,7 @@ part of rx_types; | ||
2 | 2 | ||
3 | /// This class is the foundation for all reactive (Rx) classes that makes Get | 3 | /// This class is the foundation for all reactive (Rx) classes that makes Get |
4 | /// so powerful. | 4 | /// so powerful. |
5 | -/// This interface is the contract that [_RxImpl]<[T]> uses in all it's | 5 | +/// This interface is the contract that _RxImpl]<T> uses in all it's |
6 | /// subclass. | 6 | /// subclass. |
7 | abstract class RxInterface<T> { | 7 | abstract class RxInterface<T> { |
8 | bool get canUpdate; | 8 | bool get canUpdate; |
@@ -15,7 +15,7 @@ abstract class RxInterface<T> { | @@ -15,7 +15,7 @@ abstract class RxInterface<T> { | ||
15 | 15 | ||
16 | static RxInterface? proxy; | 16 | static RxInterface? proxy; |
17 | 17 | ||
18 | - /// Calls [callback] with current value, when the value changes. | 18 | + /// Calls `callback` with current value, when the value changes. |
19 | StreamSubscription<T> listen(void Function(T event) onData, | 19 | StreamSubscription<T> listen(void Function(T event) onData, |
20 | {Function? onError, void Function()? onDone, bool? cancelOnError}); | 20 | {Function? onError, void Function()? onDone, bool? cancelOnError}); |
21 | 21 |
@@ -32,11 +32,11 @@ class Workers { | @@ -32,11 +32,11 @@ class Workers { | ||
32 | /// | 32 | /// |
33 | /// Sample: | 33 | /// Sample: |
34 | /// Every time increment() is called, ever() will process the [condition] | 34 | /// Every time increment() is called, ever() will process the [condition] |
35 | -/// (can be a [bool] expression or a [bool Function()]), and only call | 35 | +/// (can be a [bool] expression or a `bool Function()`), and only call |
36 | /// the callback when [condition] is true. | 36 | /// the callback when [condition] is true. |
37 | /// In our case, only when count is bigger to 5. In order to "dispose" | 37 | /// In our case, only when count is bigger to 5. In order to "dispose" |
38 | /// this Worker | 38 | /// this Worker |
39 | -/// that will run forever, we made a [worker] variable. So, when the count value | 39 | +/// that will run forever, we made a `worker` variable. So, when the count value |
40 | /// reaches 10, the worker gets disposed, and releases any memory resources. | 40 | /// reaches 10, the worker gets disposed, and releases any memory resources. |
41 | /// | 41 | /// |
42 | /// ``` | 42 | /// ``` |
@@ -78,7 +78,7 @@ Worker ever<T>( | @@ -78,7 +78,7 @@ Worker ever<T>( | ||
78 | /// Similar to [ever], but takes a list of [listeners], the condition | 78 | /// Similar to [ever], but takes a list of [listeners], the condition |
79 | /// for the [callback] is common to all [listeners], | 79 | /// for the [callback] is common to all [listeners], |
80 | /// and the [callback] is executed to each one of them. The [Worker] is | 80 | /// and the [callback] is executed to each one of them. The [Worker] is |
81 | -/// common to all, so [worker.dispose()] will cancel all streams. | 81 | +/// common to all, so `worker.dispose()` will cancel all streams. |
82 | Worker everAll( | 82 | Worker everAll( |
83 | List<RxInterface> listeners, | 83 | List<RxInterface> listeners, |
84 | WorkerCallback callback, { | 84 | WorkerCallback callback, { |
@@ -110,10 +110,10 @@ Worker everAll( | @@ -110,10 +110,10 @@ Worker everAll( | ||
110 | return Worker(cancel, '[everAll]'); | 110 | return Worker(cancel, '[everAll]'); |
111 | } | 111 | } |
112 | 112 | ||
113 | -/// [once()] will execute only 1 time when [condition] is met and cancel | 113 | +/// `once()` will execute only 1 time when [condition] is met and cancel |
114 | /// the subscription to the [listener] stream right after that. | 114 | /// the subscription to the [listener] stream right after that. |
115 | /// [condition] defines when [callback] is called, and | 115 | /// [condition] defines when [callback] is called, and |
116 | -/// can be a [bool] or a [bool Function()]. | 116 | +/// can be a [bool] or a `bool Function()`. |
117 | /// | 117 | /// |
118 | /// Sample: | 118 | /// Sample: |
119 | /// ``` | 119 | /// ``` |
@@ -158,7 +158,7 @@ Worker once<T>( | @@ -158,7 +158,7 @@ Worker once<T>( | ||
158 | } | 158 | } |
159 | 159 | ||
160 | /// Ignore all changes in [listener] during [time] (1 sec by default) or until | 160 | /// Ignore all changes in [listener] during [time] (1 sec by default) or until |
161 | -/// [condition] is met (can be a [bool] expression or a [bool Function()]), | 161 | +/// [condition] is met (can be a [bool] expression or a `bool Function()`), |
162 | /// It brings the 1st "value" since the period of time, so | 162 | /// It brings the 1st "value" since the period of time, so |
163 | /// if you click a counter button 3 times in 1 sec, it will show you "1" | 163 | /// if you click a counter button 3 times in 1 sec, it will show you "1" |
164 | /// (after 1 sec of the first press) | 164 | /// (after 1 sec of the first press) |
1 | import 'dart:async'; | 1 | import 'dart:async'; |
2 | 2 | ||
3 | -/// This "function" class is the implementation of [debouncer()] Worker. | 3 | +/// This "function" class is the implementation of `debouncer()` Worker. |
4 | /// It calls the function passed after specified [delay] parameter. | 4 | /// It calls the function passed after specified [delay] parameter. |
5 | /// Example: | 5 | /// Example: |
6 | /// ``` | 6 | /// ``` |
1 | import 'package:flutter/scheduler.dart'; | 1 | import 'package:flutter/scheduler.dart'; |
2 | import '../../get_state_manager.dart'; | 2 | import '../../get_state_manager.dart'; |
3 | 3 | ||
4 | -/// Used like [SingleTickerProviderMixin] but only with Get Controllers. | 4 | +/// Used like `SingleTickerProviderMixin` but only with Get Controllers. |
5 | /// Simplifies AnimationController creation inside GetxController. | 5 | /// Simplifies AnimationController creation inside GetxController. |
6 | /// | 6 | /// |
7 | /// Example: | 7 | /// Example: |
@@ -9,7 +9,7 @@ import 'list_notifier.dart'; | @@ -9,7 +9,7 @@ import 'list_notifier.dart'; | ||
9 | // ignore: prefer_mixin | 9 | // ignore: prefer_mixin |
10 | abstract class GetxController extends DisposableInterface | 10 | abstract class GetxController extends DisposableInterface |
11 | with ListenableMixin, ListNotifierMixin { | 11 | with ListenableMixin, ListNotifierMixin { |
12 | - /// Rebuilds [GetBuilder] each time you call [update()]; | 12 | + /// Rebuilds `GetBuilder` each time you call `update()`; |
13 | /// Can take a List of [ids], that will only update the matching | 13 | /// Can take a List of [ids], that will only update the matching |
14 | /// `GetBuilder( id: )`, | 14 | /// `GetBuilder( id: )`, |
15 | /// [ids] can be reused among `GetBuilders` like group tags. | 15 | /// [ids] can be reused among `GetBuilders` like group tags. |
@@ -82,13 +82,13 @@ class ResponsiveScreenSettings { | @@ -82,13 +82,13 @@ class ResponsiveScreenSettings { | ||
82 | /// When the width is greater als this value | 82 | /// When the width is greater als this value |
83 | /// the display will be set as [ScreenType.Tablet] | 83 | /// the display will be set as [ScreenType.Tablet] |
84 | /// or when width greater als [watchChangePoint] and smaller als this value | 84 | /// or when width greater als [watchChangePoint] and smaller als this value |
85 | - /// the display will be [ScreenType.Mobile] | 85 | + /// the display will be [ScreenType.Phone] |
86 | final double tabletChangePoint; | 86 | final double tabletChangePoint; |
87 | 87 | ||
88 | /// When the width is smaller als this value | 88 | /// When the width is smaller als this value |
89 | /// the display will be set as [ScreenType.Watch] | 89 | /// the display will be set as [ScreenType.Watch] |
90 | /// or when width greater als this value and smaller als [tabletChangePoint] | 90 | /// or when width greater als this value and smaller als [tabletChangePoint] |
91 | - /// the display will be [ScreenType.Mobile] | 91 | + /// the display will be [ScreenType.Phone] |
92 | final double watchChangePoint; | 92 | final double watchChangePoint; |
93 | 93 | ||
94 | const ResponsiveScreenSettings( | 94 | const ResponsiveScreenSettings( |
@@ -115,7 +115,7 @@ class ResponsiveScreen { | @@ -115,7 +115,7 @@ class ResponsiveScreen { | ||
115 | /// Is [screenType] [ScreenType.Tablet] | 115 | /// Is [screenType] [ScreenType.Tablet] |
116 | bool get isTablet => (screenType == ScreenType.Tablet); | 116 | bool get isTablet => (screenType == ScreenType.Tablet); |
117 | 117 | ||
118 | - /// Is [screenType] [ScreenType.Mobile] | 118 | + /// Is [screenType] [ScreenType.Phone] |
119 | bool get isPhone => (screenType == ScreenType.Phone); | 119 | bool get isPhone => (screenType == ScreenType.Phone); |
120 | 120 | ||
121 | /// Is [screenType] [ScreenType.Watch] | 121 | /// Is [screenType] [ScreenType.Watch] |
@@ -4,10 +4,10 @@ import '../../../instance_manager.dart'; | @@ -4,10 +4,10 @@ import '../../../instance_manager.dart'; | ||
4 | import '../../get_state_manager.dart'; | 4 | import '../../get_state_manager.dart'; |
5 | import 'list_notifier.dart'; | 5 | import 'list_notifier.dart'; |
6 | 6 | ||
7 | -/// Complies with [GetStateUpdater] | 7 | +/// Complies with `GetStateUpdater` |
8 | /// | 8 | /// |
9 | -/// This mixin's function represents a [GetStateUpdater], and might be used | ||
10 | -/// by [GetBuilder()], [SimpleBuilder()] (or similar) to comply | 9 | +/// This mixin's function represents a `GetStateUpdater`, and might be used |
10 | +/// by `GetBuilder()`, `SimpleBuilder()` (or similar) to comply | ||
11 | /// with [GetStateUpdate] signature. REPLACING the [StateSetter]. | 11 | /// with [GetStateUpdate] signature. REPLACING the [StateSetter]. |
12 | /// Avoids the potential (but extremely unlikely) issue of having | 12 | /// Avoids the potential (but extremely unlikely) issue of having |
13 | /// the Widget in a dispose() state, and abstracts the | 13 | /// the Widget in a dispose() state, and abstracts the |
@@ -45,8 +45,8 @@ abstract class GetView<T> extends StatelessWidget { | @@ -45,8 +45,8 @@ abstract class GetView<T> extends StatelessWidget { | ||
45 | /// without having to call Get.find<AwesomeController>() yourself. | 45 | /// without having to call Get.find<AwesomeController>() yourself. |
46 | /// Get save you controller on cache, so, you can to use Get.create() safely | 46 | /// Get save you controller on cache, so, you can to use Get.create() safely |
47 | /// GetWidget is perfect to multiples instance of a same controller. Each | 47 | /// GetWidget is perfect to multiples instance of a same controller. Each |
48 | -/// GetWidget will have your own controller, and will be call events as [onInit] | ||
49 | -/// and [onClose] when the controller get in/get out on memory. | 48 | +/// GetWidget will have your own controller, and will be call events as `onInit` |
49 | +/// and `onClose` when the controller get in/get out on memory. | ||
50 | abstract class GetWidget<S extends GetLifeCycleBase?> extends GetWidgetCache { | 50 | abstract class GetWidget<S extends GetLifeCycleBase?> extends GetWidgetCache { |
51 | const GetWidget({Key? key}) : super(key: key); | 51 | const GetWidget({Key? key}) : super(key: key); |
52 | 52 |
@@ -132,7 +132,7 @@ mixin ListNotifierMixin on ListenableMixin { | @@ -132,7 +132,7 @@ mixin ListNotifierMixin on ListenableMixin { | ||
132 | } | 132 | } |
133 | 133 | ||
134 | /// To dispose an [id] from future updates(), this ids are registered | 134 | /// To dispose an [id] from future updates(), this ids are registered |
135 | - /// by [GetBuilder()] or similar, so is a way to unlink the state change with | 135 | + /// by `GetBuilder()` or similar, so is a way to unlink the state change with |
136 | /// the Widget from the Controller. | 136 | /// the Widget from the Controller. |
137 | void disposeId(Object id) { | 137 | void disposeId(Object id) { |
138 | _updatersGroupIds!.remove(id); | 138 | _updatersGroupIds!.remove(id); |
@@ -270,7 +270,7 @@ class GetUtils { | @@ -270,7 +270,7 @@ class GetUtils { | ||
270 | } | 270 | } |
271 | 271 | ||
272 | /// Checks if all data have same value. | 272 | /// Checks if all data have same value. |
273 | - /// Example: 111111 -> true, wwwww -> true, [1,1,1,1] -> true | 273 | + /// Example: 111111 -> true, wwwww -> true, 1,1,1,1 -> true |
274 | static bool isOneAKind(dynamic value) { | 274 | static bool isOneAKind(dynamic value) { |
275 | if ((value is String || value is List) && !isNullOrBlank(value)!) { | 275 | if ((value is String || value is List) && !isNullOrBlank(value)!) { |
276 | final first = value[0]; | 276 | final first = value[0]; |
1 | name: get | 1 | name: get |
2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. | 2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. |
3 | -version: 4.2.0 | 3 | +version: 4.2.1+2 |
4 | homepage: https://github.com/jonataslaw/getx | 4 | homepage: https://github.com/jonataslaw/getx |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment