Committed by
GitHub
Merge pull request #2896 from jonataslaw/rename_create
rename create -> spawn and change logic of new GetWidget
Showing
15 changed files
with
59 additions
and
91 deletions
| @@ -2,13 +2,14 @@ | @@ -2,13 +2,14 @@ | ||
| 2 | FLUTTER_ROOT=/Users/jonatasborges/flutter | 2 | FLUTTER_ROOT=/Users/jonatasborges/flutter |
| 3 | FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx5/getx/example_nav2 | 3 | FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx5/getx/example_nav2 |
| 4 | COCOAPODS_PARALLEL_CODE_SIGN=true | 4 | COCOAPODS_PARALLEL_CODE_SIGN=true |
| 5 | -FLUTTER_TARGET=lib/main.dart | 5 | +FLUTTER_TARGET=/Users/jonatasborges/getx5/getx/example_nav2/lib/main.dart |
| 6 | FLUTTER_BUILD_DIR=build | 6 | FLUTTER_BUILD_DIR=build |
| 7 | FLUTTER_BUILD_NAME=1.0.0 | 7 | FLUTTER_BUILD_NAME=1.0.0 |
| 8 | FLUTTER_BUILD_NUMBER=1 | 8 | FLUTTER_BUILD_NUMBER=1 |
| 9 | EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 | 9 | EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 |
| 10 | EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 | 10 | EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 |
| 11 | +DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iMjAxODNlMDQwOTYwOTRiY2MzN2Q5Y2RlMmE0Yjk2ZjVjYzY4NGNmLw== | ||
| 11 | DART_OBFUSCATION=false | 12 | DART_OBFUSCATION=false |
| 12 | TRACK_WIDGET_CREATION=true | 13 | TRACK_WIDGET_CREATION=true |
| 13 | TREE_SHAKE_ICONS=false | 14 | TREE_SHAKE_ICONS=false |
| 14 | -PACKAGE_CONFIG=.dart_tool/package_config.json | 15 | +PACKAGE_CONFIG=/Users/jonatasborges/getx5/getx/example_nav2/.dart_tool/package_config.json |
| @@ -3,11 +3,12 @@ | @@ -3,11 +3,12 @@ | ||
| 3 | export "FLUTTER_ROOT=/Users/jonatasborges/flutter" | 3 | export "FLUTTER_ROOT=/Users/jonatasborges/flutter" |
| 4 | export "FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx5/getx/example_nav2" | 4 | export "FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx5/getx/example_nav2" |
| 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" | 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
| 6 | -export "FLUTTER_TARGET=lib/main.dart" | 6 | +export "FLUTTER_TARGET=/Users/jonatasborges/getx5/getx/example_nav2/lib/main.dart" |
| 7 | export "FLUTTER_BUILD_DIR=build" | 7 | export "FLUTTER_BUILD_DIR=build" |
| 8 | export "FLUTTER_BUILD_NAME=1.0.0" | 8 | export "FLUTTER_BUILD_NAME=1.0.0" |
| 9 | export "FLUTTER_BUILD_NUMBER=1" | 9 | export "FLUTTER_BUILD_NUMBER=1" |
| 10 | +export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iMjAxODNlMDQwOTYwOTRiY2MzN2Q5Y2RlMmE0Yjk2ZjVjYzY4NGNmLw==" | ||
| 10 | export "DART_OBFUSCATION=false" | 11 | export "DART_OBFUSCATION=false" |
| 11 | export "TRACK_WIDGET_CREATION=true" | 12 | export "TRACK_WIDGET_CREATION=true" |
| 12 | export "TREE_SHAKE_ICONS=false" | 13 | export "TREE_SHAKE_ICONS=false" |
| 13 | -export "PACKAGE_CONFIG=.dart_tool/package_config.json" | 14 | +export "PACKAGE_CONFIG=/Users/jonatasborges/getx5/getx/example_nav2/.dart_tool/package_config.json" |
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | archiveVersion = 1; | 3 | archiveVersion = 1; |
| 4 | classes = { | 4 | classes = { |
| 5 | }; | 5 | }; |
| 6 | - objectVersion = 50; | 6 | + objectVersion = 54; |
| 7 | objects = { | 7 | objects = { |
| 8 | 8 | ||
| 9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
| @@ -127,7 +127,7 @@ | @@ -127,7 +127,7 @@ | ||
| 127 | 97C146E61CF9000F007C117D /* Project object */ = { | 127 | 97C146E61CF9000F007C117D /* Project object */ = { |
| 128 | isa = PBXProject; | 128 | isa = PBXProject; |
| 129 | attributes = { | 129 | attributes = { |
| 130 | - LastUpgradeCheck = 1300; | 130 | + LastUpgradeCheck = 1430; |
| 131 | ORGANIZATIONNAME = ""; | 131 | ORGANIZATIONNAME = ""; |
| 132 | TargetAttributes = { | 132 | TargetAttributes = { |
| 133 | 97C146ED1CF9000F007C117D = { | 133 | 97C146ED1CF9000F007C117D = { |
| @@ -171,10 +171,12 @@ | @@ -171,10 +171,12 @@ | ||
| 171 | /* Begin PBXShellScriptBuildPhase section */ | 171 | /* Begin PBXShellScriptBuildPhase section */ |
| 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { | 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { |
| 173 | isa = PBXShellScriptBuildPhase; | 173 | isa = PBXShellScriptBuildPhase; |
| 174 | + alwaysOutOfDate = 1; | ||
| 174 | buildActionMask = 2147483647; | 175 | buildActionMask = 2147483647; |
| 175 | files = ( | 176 | files = ( |
| 176 | ); | 177 | ); |
| 177 | inputPaths = ( | 178 | inputPaths = ( |
| 179 | + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", | ||
| 178 | ); | 180 | ); |
| 179 | name = "Thin Binary"; | 181 | name = "Thin Binary"; |
| 180 | outputPaths = ( | 182 | outputPaths = ( |
| @@ -185,6 +187,7 @@ | @@ -185,6 +187,7 @@ | ||
| 185 | }; | 187 | }; |
| 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { | 188 | 9740EEB61CF901F6004384FC /* Run Script */ = { |
| 187 | isa = PBXShellScriptBuildPhase; | 189 | isa = PBXShellScriptBuildPhase; |
| 190 | + alwaysOutOfDate = 1; | ||
| 188 | buildActionMask = 2147483647; | 191 | buildActionMask = 2147483647; |
| 189 | files = ( | 192 | files = ( |
| 190 | ); | 193 | ); |
| @@ -6,8 +6,8 @@ class ProductDetailsBinding extends Binding { | @@ -6,8 +6,8 @@ class ProductDetailsBinding extends Binding { | ||
| 6 | @override | 6 | @override |
| 7 | List<Bind> dependencies() { | 7 | List<Bind> dependencies() { |
| 8 | return [ | 8 | return [ |
| 9 | - Bind.create<ProductDetailsController>( | ||
| 10 | - (_) => ProductDetailsController( | 9 | + Bind.spawn<ProductDetailsController>( |
| 10 | + () => ProductDetailsController( | ||
| 11 | Get.parameters['productId'] ?? '', | 11 | Get.parameters['productId'] ?? '', |
| 12 | ), | 12 | ), |
| 13 | ) | 13 | ) |
| 1 | -import 'dart:async'; | ||
| 2 | - | ||
| 3 | -import 'package:async/async.dart'; | ||
| 4 | -import 'package:get/get.dart'; | ||
| 5 | - | ||
| 6 | -class SplashService extends GetxService { | ||
| 7 | - final welcomeStr = ['GetX', 'Rules!']; | ||
| 8 | - final activeStr = 0.obs; | ||
| 9 | - | ||
| 10 | - final memo = AsyncMemoizer<void>(); | ||
| 11 | - Future<void> init() { | ||
| 12 | - return memo.runOnce(_initFunction); | ||
| 13 | - } | ||
| 14 | - | ||
| 15 | - void _changeActiveString() { | ||
| 16 | - activeStr.value = (activeStr.value + 1) % welcomeStr.length; | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - Future<void> _initFunction() async { | ||
| 20 | - final t = Timer.periodic( | ||
| 21 | - const Duration(milliseconds: 500), | ||
| 22 | - (t) => _changeActiveString(), | ||
| 23 | - ); | ||
| 24 | - //simulate some long running operation | ||
| 25 | - await Future.delayed(const Duration(seconds: 5)); | ||
| 26 | - //cancel the timer once we are done | ||
| 27 | - t.cancel(); | ||
| 28 | - } | ||
| 29 | -} |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:get/get.dart'; | ||
| 3 | - | ||
| 4 | -import '../controllers/splash_service.dart'; | ||
| 5 | - | ||
| 6 | -class SplashView extends GetView<SplashService> { | ||
| 7 | - const SplashView({super.key}); | ||
| 8 | - | ||
| 9 | - @override | ||
| 10 | - Widget build(BuildContext context) { | ||
| 11 | - return Scaffold( | ||
| 12 | - body: Center( | ||
| 13 | - child: Column( | ||
| 14 | - mainAxisSize: MainAxisSize.min, | ||
| 15 | - children: [ | ||
| 16 | - Obx( | ||
| 17 | - () => Text( | ||
| 18 | - controller.welcomeStr[controller.activeStr.value], | ||
| 19 | - style: const TextStyle(fontSize: 20), | ||
| 20 | - ), | ||
| 21 | - ), | ||
| 22 | - const CircularProgressIndicator(), | ||
| 23 | - ], | ||
| 24 | - ), | ||
| 25 | - ), | ||
| 26 | - ); | ||
| 27 | - } | ||
| 28 | -} |
| @@ -2,7 +2,6 @@ import 'package:example_nav2/services/auth_service.dart'; | @@ -2,7 +2,6 @@ import 'package:example_nav2/services/auth_service.dart'; | ||
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:get/get.dart'; | 3 | import 'package:get/get.dart'; |
| 4 | 4 | ||
| 5 | -import 'app/modules/splash/controllers/splash_service.dart'; | ||
| 6 | import 'app/routes/app_pages.dart'; | 5 | import 'app/routes/app_pages.dart'; |
| 7 | 6 | ||
| 8 | void main() { | 7 | void main() { |
| @@ -10,7 +9,6 @@ void main() { | @@ -10,7 +9,6 @@ void main() { | ||
| 10 | GetMaterialApp( | 9 | GetMaterialApp( |
| 11 | title: "Application", | 10 | title: "Application", |
| 12 | binds: [ | 11 | binds: [ |
| 13 | - Bind.put(SplashService()), | ||
| 14 | Bind.put(AuthService()), | 12 | Bind.put(AuthService()), |
| 15 | ], | 13 | ], |
| 16 | getPages: AppPages.routes, | 14 | getPages: AppPages.routes, |
| @@ -127,16 +127,16 @@ extension Inst on GetInterface { | @@ -127,16 +127,16 @@ extension Inst on GetInterface { | ||
| 127 | /// Route `Get.reference` to keep the lifecycle active. | 127 | /// Route `Get.reference` to keep the lifecycle active. |
| 128 | /// Is important to know that the instances created are only stored per Route. | 128 | /// Is important to know that the instances created are only stored per Route. |
| 129 | /// So, if you call `Get.delete<T>()` the "instance factory" used in this | 129 | /// So, if you call `Get.delete<T>()` the "instance factory" used in this |
| 130 | - /// method (`Get.create<T>()`) will be removed, but NOT the instances | 130 | + /// method (`Get.spawn<T>()`) will be removed, but NOT the instances |
| 131 | /// already created by it. | 131 | /// already created by it. |
| 132 | /// | 132 | /// |
| 133 | /// Example: | 133 | /// Example: |
| 134 | /// | 134 | /// |
| 135 | - /// ```create(() => Repl()); | 135 | + /// ```Get.spawn(() => Repl()); |
| 136 | /// Repl a = find(); | 136 | /// Repl a = find(); |
| 137 | /// Repl b = find(); | 137 | /// Repl b = find(); |
| 138 | /// print(a==b); (false)``` | 138 | /// print(a==b); (false)``` |
| 139 | - void create<S>( | 139 | + void spawn<S>( |
| 140 | InstanceBuilderCallback<S> builder, { | 140 | InstanceBuilderCallback<S> builder, { |
| 141 | String? tag, | 141 | String? tag, |
| 142 | bool permanent = true, | 142 | bool permanent = true, |
| @@ -298,7 +298,6 @@ extension Inst on GetInterface { | @@ -298,7 +298,6 @@ extension Inst on GetInterface { | ||
| 298 | } | 298 | } |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | - | ||
| 302 | /// The findOrNull method will return the instance if it is registered; | 301 | /// The findOrNull method will return the instance if it is registered; |
| 303 | /// otherwise, it will return null. | 302 | /// otherwise, it will return null. |
| 304 | S? findOrNull<S>({String? tag}) { | 303 | S? findOrNull<S>({String? tag}) { |
| @@ -308,7 +307,6 @@ extension Inst on GetInterface { | @@ -308,7 +307,6 @@ extension Inst on GetInterface { | ||
| 308 | return null; | 307 | return null; |
| 309 | } | 308 | } |
| 310 | 309 | ||
| 311 | - | ||
| 312 | /// Replace a parent instance of a class in dependency management | 310 | /// Replace a parent instance of a class in dependency management |
| 313 | /// with a [child] instance | 311 | /// with a [child] instance |
| 314 | /// - [tag] optional, if you use a [tag] to register the Instance. | 312 | /// - [tag] optional, if you use a [tag] to register the Instance. |
| @@ -30,13 +30,13 @@ class GetInformationParser extends RouteInformationParser<RouteDecoder> { | @@ -30,13 +30,13 @@ class GetInformationParser extends RouteInformationParser<RouteDecoder> { | ||
| 30 | .any((element) => element.name == '/')) { | 30 | .any((element) => element.name == '/')) { |
| 31 | location = initialRoute; | 31 | location = initialRoute; |
| 32 | } | 32 | } |
| 33 | + } else if (location.isEmpty) { | ||
| 34 | + location = initialRoute; | ||
| 33 | } | 35 | } |
| 34 | 36 | ||
| 35 | Get.log('GetInformationParser: route location: $location'); | 37 | Get.log('GetInformationParser: route location: $location'); |
| 36 | 38 | ||
| 37 | - final routeName = location ?? initialRoute; | ||
| 38 | - | ||
| 39 | - return SynchronousFuture(RouteDecoder.fromRoute(routeName)); | 39 | + return SynchronousFuture(RouteDecoder.fromRoute(location)); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | @override | 42 | @override |
| @@ -13,9 +13,9 @@ class Dependencies { | @@ -13,9 +13,9 @@ class Dependencies { | ||
| 13 | return find<S>(); | 13 | return find<S>(); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | - void create<S>(InstanceBuilderCallback<S> builder, | 16 | + void spawn<S>(InstanceBuilderCallback<S> builder, |
| 17 | {String? tag, bool permanent = true}) => | 17 | {String? tag, bool permanent = true}) => |
| 18 | - Get.create<S>(builder, tag: tag, permanent: permanent); | 18 | + Get.spawn<S>(builder, tag: tag, permanent: permanent); |
| 19 | 19 | ||
| 20 | S find<S>({String? tag}) => Get.find<S>(tag: tag); | 20 | S find<S>({String? tag}) => Get.find<S>(tag: tag); |
| 21 | 21 |
| @@ -160,6 +160,16 @@ abstract class Bind<T> extends StatelessWidget { | @@ -160,6 +160,16 @@ abstract class Bind<T> extends StatelessWidget { | ||
| 160 | ); | 160 | ); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | + static Bind spawn<S>(InstanceBuilderCallback<S> builder, | ||
| 164 | + {String? tag, bool permanent = true}) { | ||
| 165 | + Get.spawn<S>(builder, tag: tag, permanent: permanent); | ||
| 166 | + return _FactoryBind<S>( | ||
| 167 | + tag: tag, | ||
| 168 | + global: false, | ||
| 169 | + autoRemove: permanent, | ||
| 170 | + ); | ||
| 171 | + } | ||
| 172 | + | ||
| 163 | static S find<S>({String? tag}) => Get.find<S>(tag: tag); | 173 | static S find<S>({String? tag}) => Get.find<S>(tag: tag); |
| 164 | 174 | ||
| 165 | static Future<bool> delete<S>({String? tag, bool force = false}) async => | 175 | static Future<bool> delete<S>({String? tag, bool force = false}) async => |
| @@ -465,7 +475,7 @@ class BindElement<T> extends InheritedElement { | @@ -465,7 +475,7 @@ class BindElement<T> extends InheritedElement { | ||
| 465 | } else { | 475 | } else { |
| 466 | if (widget.create != null) { | 476 | if (widget.create != null) { |
| 467 | _controllerBuilder = () => widget.create!.call(this); | 477 | _controllerBuilder = () => widget.create!.call(this); |
| 468 | - Get.create<T>(_controllerBuilder!, tag: widget.tag, permanent: false); | 478 | + Get.spawn<T>(_controllerBuilder!, tag: widget.tag, permanent: false); |
| 469 | } else { | 479 | } else { |
| 470 | _controllerBuilder = widget.init; | 480 | _controllerBuilder = widget.init; |
| 471 | } | 481 | } |
| @@ -2,6 +2,7 @@ import 'package:flutter/widgets.dart'; | @@ -2,6 +2,7 @@ import 'package:flutter/widgets.dart'; | ||
| 2 | 2 | ||
| 3 | import '../../../instance_manager.dart'; | 3 | import '../../../instance_manager.dart'; |
| 4 | import '../../../utils.dart'; | 4 | import '../../../utils.dart'; |
| 5 | +import 'get_state.dart'; | ||
| 5 | import 'get_widget_cache.dart'; | 6 | import 'get_widget_cache.dart'; |
| 6 | 7 | ||
| 7 | /// GetView is a great way of quickly access your Controller | 8 | /// GetView is a great way of quickly access your Controller |
| @@ -101,6 +102,9 @@ class _GetCache<S extends GetLifeCycleMixin> extends WidgetCache<GetWidget<S>> { | @@ -101,6 +102,9 @@ class _GetCache<S extends GetLifeCycleMixin> extends WidgetCache<GetWidget<S>> { | ||
| 101 | 102 | ||
| 102 | @override | 103 | @override |
| 103 | Widget build(BuildContext context) { | 104 | Widget build(BuildContext context) { |
| 104 | - return widget!.build(context); | 105 | + return Binder( |
| 106 | + init: () => _controller, | ||
| 107 | + child: widget!.build(context), | ||
| 108 | + ); | ||
| 105 | } | 109 | } |
| 106 | } | 110 | } |
| @@ -55,9 +55,12 @@ void main() { | @@ -55,9 +55,12 @@ void main() { | ||
| 55 | final instance = Get.put<Controller>(Controller(), tag: 'one'); | 55 | final instance = Get.put<Controller>(Controller(), tag: 'one'); |
| 56 | final instance2 = Get.put<Controller>(Controller(), tag: 'two'); | 56 | final instance2 = Get.put<Controller>(Controller(), tag: 'two'); |
| 57 | expect(instance == instance2, false); | 57 | expect(instance == instance2, false); |
| 58 | - expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'two'), false); | ||
| 59 | - expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'one'), true); | ||
| 60 | - expect(Get.find<Controller>(tag: 'two') == Get.find<Controller>(tag: 'two'), true); | 58 | + expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'two'), |
| 59 | + false); | ||
| 60 | + expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'one'), | ||
| 61 | + true); | ||
| 62 | + expect(Get.find<Controller>(tag: 'two') == Get.find<Controller>(tag: 'two'), | ||
| 63 | + true); | ||
| 61 | Get.reset(); | 64 | Get.reset(); |
| 62 | }); | 65 | }); |
| 63 | 66 | ||
| @@ -65,9 +68,12 @@ void main() { | @@ -65,9 +68,12 @@ void main() { | ||
| 65 | Get.lazyPut<Controller>(() => Controller(), tag: 'one'); | 68 | Get.lazyPut<Controller>(() => Controller(), tag: 'one'); |
| 66 | Get.lazyPut<Controller>(() => Controller(), tag: 'two'); | 69 | Get.lazyPut<Controller>(() => Controller(), tag: 'two'); |
| 67 | 70 | ||
| 68 | - expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'two'), false); | ||
| 69 | - expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'one'), true); | ||
| 70 | - expect(Get.find<Controller>(tag: 'two') == Get.find<Controller>(tag: 'two'), true); | 71 | + expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'two'), |
| 72 | + false); | ||
| 73 | + expect(Get.find<Controller>(tag: 'one') == Get.find<Controller>(tag: 'one'), | ||
| 74 | + true); | ||
| 75 | + expect(Get.find<Controller>(tag: 'two') == Get.find<Controller>(tag: 'two'), | ||
| 76 | + true); | ||
| 71 | Get.reset(); | 77 | Get.reset(); |
| 72 | }); | 78 | }); |
| 73 | 79 | ||
| @@ -95,7 +101,8 @@ void main() { | @@ -95,7 +101,8 @@ void main() { | ||
| 95 | 101 | ||
| 96 | expect(Get.find<Controller>().count, 1); | 102 | expect(Get.find<Controller>().count, 1); |
| 97 | Get.delete<Controller>(); | 103 | Get.delete<Controller>(); |
| 98 | - expect(() => Get.find<Controller>(), throwsA(const m.TypeMatcher<String>())); | 104 | + expect( |
| 105 | + () => Get.find<Controller>(), throwsA(const m.TypeMatcher<String>())); | ||
| 99 | Get.reset(); | 106 | Get.reset(); |
| 100 | }); | 107 | }); |
| 101 | 108 | ||
| @@ -134,7 +141,7 @@ void main() { | @@ -134,7 +141,7 @@ void main() { | ||
| 134 | }); | 141 | }); |
| 135 | 142 | ||
| 136 | test('Get.create with abstract class test', () async { | 143 | test('Get.create with abstract class test', () async { |
| 137 | - Get.create<Service>(() => Api()); | 144 | + Get.spawn<Service>(() => Api()); |
| 138 | final ct1 = Get.find<Service>(); | 145 | final ct1 = Get.find<Service>(); |
| 139 | final ct2 = Get.find<Service>(); | 146 | final ct2 = Get.find<Service>(); |
| 140 | // expect(ct1 is Service, true); | 147 | // expect(ct1 is Service, true); |
| @@ -155,10 +162,12 @@ void main() { | @@ -155,10 +162,12 @@ void main() { | ||
| 155 | test('Get.delete test with disposable controller', () async { | 162 | test('Get.delete test with disposable controller', () async { |
| 156 | // Get.put(DisposableController()); | 163 | // Get.put(DisposableController()); |
| 157 | expect(Get.delete<DisposableController>(), true); | 164 | expect(Get.delete<DisposableController>(), true); |
| 158 | - expect(() => Get.find<DisposableController>(), throwsA(const m.TypeMatcher<String>())); | 165 | + expect(() => Get.find<DisposableController>(), |
| 166 | + throwsA(const m.TypeMatcher<String>())); | ||
| 159 | }); | 167 | }); |
| 160 | 168 | ||
| 161 | - test('Get.put test after delete with disposable controller and init check', () async { | 169 | + test('Get.put test after delete with disposable controller and init check', |
| 170 | + () async { | ||
| 162 | final instance = Get.put<DisposableController>(DisposableController()); | 171 | final instance = Get.put<DisposableController>(DisposableController()); |
| 163 | expect(instance, Get.find<DisposableController>()); | 172 | expect(instance, Get.find<DisposableController>()); |
| 164 | expect(instance.initialized, true); | 173 | expect(instance.initialized, true); |
| @@ -255,7 +264,6 @@ void main() { | @@ -255,7 +264,6 @@ void main() { | ||
| 255 | Get.delete<int>(); | 264 | Get.delete<int>(); |
| 256 | result = Get.findOrNull<int>(); | 265 | result = Get.findOrNull<int>(); |
| 257 | expect(result, null); | 266 | expect(result, null); |
| 258 | - | ||
| 259 | }); | 267 | }); |
| 260 | }); | 268 | }); |
| 261 | } | 269 | } |
-
Please register or login to post a comment