Jonny Borges

minor changes

@@ -7,7 +7,7 @@ class ProductDetailsBinding extends Binding { @@ -7,7 +7,7 @@ class ProductDetailsBinding extends Binding {
7 List<Bind> dependencies() { 7 List<Bind> dependencies() {
8 return [ 8 return [
9 Bind.create<ProductDetailsController>( 9 Bind.create<ProductDetailsController>(
10 - () => ProductDetailsController( 10 + (_) => ProductDetailsController(
11 Get.parameters['productId'] ?? '', 11 Get.parameters['productId'] ?? '',
12 ), 12 ),
13 ) 13 )
1 import 'dart:async'; 1 import 'dart:async';
2 2
  3 +import 'package:flutter/material.dart';
  4 +
3 import '../../get_core/get_core.dart'; 5 import '../../get_core/get_core.dart';
4 import '../../get_navigation/src/router_report.dart'; 6 import '../../get_navigation/src/router_report.dart';
5 import 'lifecycle.dart'; 7 import 'lifecycle.dart';
@@ -493,6 +495,10 @@ extension Inst on GetInterface { @@ -493,6 +495,10 @@ extension Inst on GetInterface {
493 495
494 typedef InstanceBuilderCallback<S> = S Function(); 496 typedef InstanceBuilderCallback<S> = S Function();
495 497
  498 +typedef InstanceCreateBuilderCallback<S> = S Function(BuildContext _);
  499 +
  500 +// typedef InstanceBuilderCallback<S> = S Function();
  501 +
496 // typedef InjectorBuilderCallback<S> = S Function(Inst); 502 // typedef InjectorBuilderCallback<S> = S Function(Inst);
497 503
498 typedef AsyncInstanceBuilderCallback<S> = Future<S> Function(); 504 typedef AsyncInstanceBuilderCallback<S> = Future<S> Function();
@@ -362,7 +362,6 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -362,7 +362,6 @@ Cannot read the previousTitle for a route that has not yet been installed''',
362 Widget child, { 362 Widget child, {
363 bool limitedSwipe = false, 363 bool limitedSwipe = false,
364 double initialOffset = 0, 364 double initialOffset = 0,
365 - Transition? transition,  
366 }) { 365 }) {
367 // Check if the route has an animation that's currently participating 366 // Check if the route has an animation that's currently participating
368 // in a back swipe gesture. 367 // in a back swipe gesture.
@@ -393,9 +392,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -393,9 +392,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
393 secondaryAnimation, 392 secondaryAnimation,
394 GetBackGestureDetector<T>( 393 GetBackGestureDetector<T>(
395 popGestureEnable: () => 394 popGestureEnable: () =>
396 - _isPopGestureEnabled(route, canSwipe(route)), 395 + _isPopGestureEnabled(route, canSwipe(route), context),
397 onStartPopGesture: () { 396 onStartPopGesture: () {
398 - assert(_isPopGestureEnabled(route, canSwipe(route))); 397 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
399 return _startPopGesture(route); 398 return _startPopGesture(route);
400 }, 399 },
401 limitedSwipe: limitedSwipe, 400 limitedSwipe: limitedSwipe,
@@ -411,7 +410,7 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -411,7 +410,7 @@ Cannot read the previousTitle for a route that has not yet been installed''',
411 final iosAnimation = animation; 410 final iosAnimation = animation;
412 animation = CurvedAnimation(parent: animation, curve: finalCurve); 411 animation = CurvedAnimation(parent: animation, curve: finalCurve);
413 412
414 - switch (transition ?? Get.defaultTransition) { 413 + switch (route.transition ?? Get.defaultTransition) {
415 case Transition.leftToRight: 414 case Transition.leftToRight:
416 return SlideLeftTransition().buildTransitions( 415 return SlideLeftTransition().buildTransitions(
417 context, 416 context,
@@ -421,9 +420,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -421,9 +420,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
421 secondaryAnimation, 420 secondaryAnimation,
422 GetBackGestureDetector<T>( 421 GetBackGestureDetector<T>(
423 popGestureEnable: () => 422 popGestureEnable: () =>
424 - _isPopGestureEnabled(route, canSwipe(route)), 423 + _isPopGestureEnabled(route, canSwipe(route), context),
425 onStartPopGesture: () { 424 onStartPopGesture: () {
426 - assert(_isPopGestureEnabled(route, canSwipe(route))); 425 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
427 return _startPopGesture(route); 426 return _startPopGesture(route);
428 }, 427 },
429 limitedSwipe: limitedSwipe, 428 limitedSwipe: limitedSwipe,
@@ -442,9 +441,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -442,9 +441,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
442 secondaryAnimation, 441 secondaryAnimation,
443 GetBackGestureDetector<T>( 442 GetBackGestureDetector<T>(
444 popGestureEnable: () => 443 popGestureEnable: () =>
445 - _isPopGestureEnabled(route, canSwipe(route)), 444 + _isPopGestureEnabled(route, canSwipe(route), context),
446 onStartPopGesture: () { 445 onStartPopGesture: () {
447 - assert(_isPopGestureEnabled(route, canSwipe(route))); 446 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
448 return _startPopGesture(route); 447 return _startPopGesture(route);
449 }, 448 },
450 limitedSwipe: limitedSwipe, 449 limitedSwipe: limitedSwipe,
@@ -463,9 +462,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -463,9 +462,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
463 secondaryAnimation, 462 secondaryAnimation,
464 GetBackGestureDetector<T>( 463 GetBackGestureDetector<T>(
465 popGestureEnable: () => 464 popGestureEnable: () =>
466 - _isPopGestureEnabled(route, canSwipe(route)), 465 + _isPopGestureEnabled(route, canSwipe(route), context),
467 onStartPopGesture: () { 466 onStartPopGesture: () {
468 - assert(_isPopGestureEnabled(route, canSwipe(route))); 467 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
469 return _startPopGesture(route); 468 return _startPopGesture(route);
470 }, 469 },
471 limitedSwipe: limitedSwipe, 470 limitedSwipe: limitedSwipe,
@@ -478,9 +477,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -478,9 +477,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
478 case Transition.noTransition: 477 case Transition.noTransition:
479 return GetBackGestureDetector<T>( 478 return GetBackGestureDetector<T>(
480 popGestureEnable: () => 479 popGestureEnable: () =>
481 - _isPopGestureEnabled(route, canSwipe(route)), 480 + _isPopGestureEnabled(route, canSwipe(route), context),
482 onStartPopGesture: () { 481 onStartPopGesture: () {
483 - assert(_isPopGestureEnabled(route, canSwipe(route))); 482 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
484 return _startPopGesture(route); 483 return _startPopGesture(route);
485 }, 484 },
486 limitedSwipe: limitedSwipe, 485 limitedSwipe: limitedSwipe,
@@ -499,9 +498,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -499,9 +498,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
499 secondaryAnimation, 498 secondaryAnimation,
500 GetBackGestureDetector<T>( 499 GetBackGestureDetector<T>(
501 popGestureEnable: () => 500 popGestureEnable: () =>
502 - _isPopGestureEnabled(route, canSwipe(route)), 501 + _isPopGestureEnabled(route, canSwipe(route), context),
503 onStartPopGesture: () { 502 onStartPopGesture: () {
504 - assert(_isPopGestureEnabled(route, canSwipe(route))); 503 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
505 return _startPopGesture(route); 504 return _startPopGesture(route);
506 }, 505 },
507 limitedSwipe: limitedSwipe, 506 limitedSwipe: limitedSwipe,
@@ -520,9 +519,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -520,9 +519,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
520 secondaryAnimation, 519 secondaryAnimation,
521 GetBackGestureDetector<T>( 520 GetBackGestureDetector<T>(
522 popGestureEnable: () => 521 popGestureEnable: () =>
523 - _isPopGestureEnabled(route, canSwipe(route)), 522 + _isPopGestureEnabled(route, canSwipe(route), context),
524 onStartPopGesture: () { 523 onStartPopGesture: () {
525 - assert(_isPopGestureEnabled(route, canSwipe(route))); 524 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
526 return _startPopGesture(route); 525 return _startPopGesture(route);
527 }, 526 },
528 limitedSwipe: limitedSwipe, 527 limitedSwipe: limitedSwipe,
@@ -541,9 +540,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -541,9 +540,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
541 secondaryAnimation, 540 secondaryAnimation,
542 GetBackGestureDetector<T>( 541 GetBackGestureDetector<T>(
543 popGestureEnable: () => 542 popGestureEnable: () =>
544 - _isPopGestureEnabled(route, canSwipe(route)), 543 + _isPopGestureEnabled(route, canSwipe(route), context),
545 onStartPopGesture: () { 544 onStartPopGesture: () {
546 - assert(_isPopGestureEnabled(route, canSwipe(route))); 545 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
547 return _startPopGesture(route); 546 return _startPopGesture(route);
548 }, 547 },
549 limitedSwipe: limitedSwipe, 548 limitedSwipe: limitedSwipe,
@@ -562,9 +561,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -562,9 +561,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
562 secondaryAnimation, 561 secondaryAnimation,
563 GetBackGestureDetector<T>( 562 GetBackGestureDetector<T>(
564 popGestureEnable: () => 563 popGestureEnable: () =>
565 - _isPopGestureEnabled(route, canSwipe(route)), 564 + _isPopGestureEnabled(route, canSwipe(route), context),
566 onStartPopGesture: () { 565 onStartPopGesture: () {
567 - assert(_isPopGestureEnabled(route, canSwipe(route))); 566 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
568 return _startPopGesture(route); 567 return _startPopGesture(route);
569 }, 568 },
570 limitedSwipe: limitedSwipe, 569 limitedSwipe: limitedSwipe,
@@ -583,9 +582,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -583,9 +582,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
583 secondaryAnimation, 582 secondaryAnimation,
584 GetBackGestureDetector<T>( 583 GetBackGestureDetector<T>(
585 popGestureEnable: () => 584 popGestureEnable: () =>
586 - _isPopGestureEnabled(route, canSwipe(route)), 585 + _isPopGestureEnabled(route, canSwipe(route), context),
587 onStartPopGesture: () { 586 onStartPopGesture: () {
588 - assert(_isPopGestureEnabled(route, canSwipe(route))); 587 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
589 return _startPopGesture(route); 588 return _startPopGesture(route);
590 }, 589 },
591 limitedSwipe: limitedSwipe, 590 limitedSwipe: limitedSwipe,
@@ -602,9 +601,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -602,9 +601,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
602 linearTransition: linearTransition, 601 linearTransition: linearTransition,
603 child: GetBackGestureDetector<T>( 602 child: GetBackGestureDetector<T>(
604 popGestureEnable: () => 603 popGestureEnable: () =>
605 - _isPopGestureEnabled(route, canSwipe(route)), 604 + _isPopGestureEnabled(route, canSwipe(route), context),
606 onStartPopGesture: () { 605 onStartPopGesture: () {
607 - assert(_isPopGestureEnabled(route, canSwipe(route))); 606 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
608 return _startPopGesture(route); 607 return _startPopGesture(route);
609 }, 608 },
610 limitedSwipe: limitedSwipe, 609 limitedSwipe: limitedSwipe,
@@ -623,9 +622,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -623,9 +622,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
623 secondaryAnimation, 622 secondaryAnimation,
624 GetBackGestureDetector<T>( 623 GetBackGestureDetector<T>(
625 popGestureEnable: () => 624 popGestureEnable: () =>
626 - _isPopGestureEnabled(route, canSwipe(route)), 625 + _isPopGestureEnabled(route, canSwipe(route), context),
627 onStartPopGesture: () { 626 onStartPopGesture: () {
628 - assert(_isPopGestureEnabled(route, canSwipe(route))); 627 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
629 return _startPopGesture(route); 628 return _startPopGesture(route);
630 }, 629 },
631 limitedSwipe: limitedSwipe, 630 limitedSwipe: limitedSwipe,
@@ -643,9 +642,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -643,9 +642,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
643 secondaryAnimation, 642 secondaryAnimation,
644 GetBackGestureDetector<T>( 643 GetBackGestureDetector<T>(
645 popGestureEnable: () => 644 popGestureEnable: () =>
646 - _isPopGestureEnabled(route, canSwipe(route)), 645 + _isPopGestureEnabled(route, canSwipe(route), context),
647 onStartPopGesture: () { 646 onStartPopGesture: () {
648 - assert(_isPopGestureEnabled(route, canSwipe(route))); 647 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
649 return _startPopGesture(route); 648 return _startPopGesture(route);
650 }, 649 },
651 limitedSwipe: limitedSwipe, 650 limitedSwipe: limitedSwipe,
@@ -663,9 +662,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -663,9 +662,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
663 secondaryAnimation, 662 secondaryAnimation,
664 GetBackGestureDetector<T>( 663 GetBackGestureDetector<T>(
665 popGestureEnable: () => 664 popGestureEnable: () =>
666 - _isPopGestureEnabled(route, canSwipe(route)), 665 + _isPopGestureEnabled(route, canSwipe(route), context),
667 onStartPopGesture: () { 666 onStartPopGesture: () {
668 - assert(_isPopGestureEnabled(route, canSwipe(route))); 667 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
669 return _startPopGesture(route); 668 return _startPopGesture(route);
670 }, 669 },
671 limitedSwipe: limitedSwipe, 670 limitedSwipe: limitedSwipe,
@@ -683,9 +682,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -683,9 +682,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
683 secondaryAnimation, 682 secondaryAnimation,
684 GetBackGestureDetector<T>( 683 GetBackGestureDetector<T>(
685 popGestureEnable: () => 684 popGestureEnable: () =>
686 - _isPopGestureEnabled(route, canSwipe(route)), 685 + _isPopGestureEnabled(route, canSwipe(route), context),
687 onStartPopGesture: () { 686 onStartPopGesture: () {
688 - assert(_isPopGestureEnabled(route, canSwipe(route))); 687 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
689 return _startPopGesture(route); 688 return _startPopGesture(route);
690 }, 689 },
691 limitedSwipe: limitedSwipe, 690 limitedSwipe: limitedSwipe,
@@ -704,9 +703,9 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -704,9 +703,9 @@ Cannot read the previousTitle for a route that has not yet been installed''',
704 secondaryAnimation, 703 secondaryAnimation,
705 GetBackGestureDetector<T>( 704 GetBackGestureDetector<T>(
706 popGestureEnable: () => 705 popGestureEnable: () =>
707 - _isPopGestureEnabled(route, canSwipe(route)), 706 + _isPopGestureEnabled(route, canSwipe(route), context),
708 onStartPopGesture: () { 707 onStartPopGesture: () {
709 - assert(_isPopGestureEnabled(route, canSwipe(route))); 708 + assert(_isPopGestureEnabled(route, canSwipe(route), context));
710 return _startPopGesture(route); 709 return _startPopGesture(route);
711 }, 710 },
712 limitedSwipe: limitedSwipe, 711 limitedSwipe: limitedSwipe,
@@ -731,9 +730,11 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -731,9 +730,11 @@ Cannot read the previousTitle for a route that has not yet been installed''',
731 secondaryAnimation, 730 secondaryAnimation,
732 GetBackGestureDetector<T>( 731 GetBackGestureDetector<T>(
733 popGestureEnable: () => 732 popGestureEnable: () =>
734 - _isPopGestureEnabled(route, canSwipe(route)), 733 + _isPopGestureEnabled(route, canSwipe(route), context),
735 onStartPopGesture: () { 734 onStartPopGesture: () {
736 - assert(_isPopGestureEnabled(route, canSwipe(route))); 735 + assert(
  736 + _isPopGestureEnabled(route, canSwipe(route), context),
  737 + );
737 return _startPopGesture(route); 738 return _startPopGesture(route);
738 }, 739 },
739 limitedSwipe: limitedSwipe, 740 limitedSwipe: limitedSwipe,
@@ -758,11 +759,13 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -758,11 +759,13 @@ Cannot read the previousTitle for a route that has not yet been installed''',
758 /// 759 ///
759 /// * [popGestureEnabled], which returns true if a user-triggered pop gesture 760 /// * [popGestureEnabled], which returns true if a user-triggered pop gesture
760 /// would be allowed. 761 /// would be allowed.
761 - // static bool isPopGestureInProgress(PageRoute<dynamic> route) {  
762 - // return route.navigator!.userGestureInProgress;  
763 - // } 762 + static bool isPopGestureInProgress(BuildContext context) {
  763 + final route = ModalRoute.of(context)!;
  764 + return route.navigator!.userGestureInProgress;
  765 + }
764 766
765 - static bool _isPopGestureEnabled<T>(PageRoute<T> route, bool canSwipe) { 767 + static bool _isPopGestureEnabled<T>(
  768 + PageRoute<T> route, bool canSwipe, BuildContext context) {
766 // If there's nothing to go back to, then obviously we don't support 769 // If there's nothing to go back to, then obviously we don't support
767 // the back gesture. 770 // the back gesture.
768 if (route.isFirst) return false; 771 if (route.isFirst) return false;
@@ -784,7 +787,7 @@ Cannot read the previousTitle for a route that has not yet been installed''', @@ -784,7 +787,7 @@ Cannot read the previousTitle for a route that has not yet been installed''',
784 return false; 787 return false;
785 } 788 }
786 // If we're in a gesture already, we cannot start another. 789 // If we're in a gesture already, we cannot start another.
787 - if (CupertinoRouteTransitionMixin.isPopGestureInProgress(route)) { 790 + if (GetPageRouteTransitionMixin.isPopGestureInProgress(context)) {
788 return false; 791 return false;
789 } 792 }
790 793
@@ -147,8 +147,7 @@ class GetRouterOutlet extends RouterOutlet<GetDelegate, RouteDecoder> { @@ -147,8 +147,7 @@ class GetRouterOutlet extends RouterOutlet<GetDelegate, RouteDecoder> {
147 return ret; 147 return ret;
148 }, 148 },
149 emptyPage: (delegate) => 149 emptyPage: (delegate) =>
150 - delegate.matchRoute(initialRoute).route ??  
151 - delegate.notFoundRoute, 150 + delegate.matchRoute(initialRoute).route ?? delegate.notFoundRoute,
152 key: Get.nestedKey(anchorRoute)?.navigatorKey, 151 key: Get.nestedKey(anchorRoute)?.navigatorKey,
153 delegate: delegate, 152 delegate: delegate,
154 ); 153 );
1 // ignore_for_file: overridden_fields 1 // ignore_for_file: overridden_fields
2 2
  3 +import 'dart:async';
  4 +
3 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
4 6
5 import '../../../instance_manager.dart'; 7 import '../../../instance_manager.dart';
@@ -149,10 +151,10 @@ abstract class Bind<T> extends StatelessWidget { @@ -149,10 +151,10 @@ abstract class Bind<T> extends StatelessWidget {
149 ); 151 );
150 } 152 }
151 153
152 - static Bind create<S>(InstanceBuilderCallback<S> builder, 154 + static Bind create<S>(InstanceCreateBuilderCallback<S> builder,
153 {String? tag, bool permanent = true}) { 155 {String? tag, bool permanent = true}) {
154 - Get.create<S>(builder, tag: tag, permanent: permanent);  
155 return _FactoryBind<S>( 156 return _FactoryBind<S>(
  157 + create: builder,
156 tag: tag, 158 tag: tag,
157 ); 159 );
158 } 160 }
@@ -192,6 +194,7 @@ abstract class Bind<T> extends StatelessWidget { @@ -192,6 +194,7 @@ abstract class Bind<T> extends StatelessWidget {
192 factory Bind.builder({ 194 factory Bind.builder({
193 Widget? child, 195 Widget? child,
194 InitBuilder<T>? init, 196 InitBuilder<T>? init,
  197 + InstanceCreateBuilderCallback<T>? create,
195 bool global = true, 198 bool global = true,
196 bool autoRemove = true, 199 bool autoRemove = true,
197 bool assignId = false, 200 bool assignId = false,
@@ -206,6 +209,7 @@ abstract class Bind<T> extends StatelessWidget { @@ -206,6 +209,7 @@ abstract class Bind<T> extends StatelessWidget {
206 _FactoryBind<T>( 209 _FactoryBind<T>(
207 // key: key, 210 // key: key,
208 init: init, 211 init: init,
  212 + create: create,
209 global: global, 213 global: global,
210 autoRemove: autoRemove, 214 autoRemove: autoRemove,
211 assignId: assignId, 215 assignId: assignId,
@@ -254,6 +258,8 @@ class _FactoryBind<T> extends Bind<T> { @@ -254,6 +258,8 @@ class _FactoryBind<T> extends Bind<T> {
254 @override 258 @override
255 final InitBuilder<T>? init; 259 final InitBuilder<T>? init;
256 260
  261 + final InstanceCreateBuilderCallback<T>? create;
  262 +
257 @override 263 @override
258 final bool global; 264 final bool global;
259 @override 265 @override
@@ -282,6 +288,7 @@ class _FactoryBind<T> extends Bind<T> { @@ -282,6 +288,7 @@ class _FactoryBind<T> extends Bind<T> {
282 Key? key, 288 Key? key,
283 this.child, 289 this.child,
284 this.init, 290 this.init,
  291 + this.create,
285 this.global = true, 292 this.global = true,
286 this.autoRemove = true, 293 this.autoRemove = true,
287 this.assignId = false, 294 this.assignId = false,
@@ -298,6 +305,7 @@ class _FactoryBind<T> extends Bind<T> { @@ -298,6 +305,7 @@ class _FactoryBind<T> extends Bind<T> {
298 Bind<T> _copyWithChild(Widget child) { 305 Bind<T> _copyWithChild(Widget child) {
299 return Bind<T>.builder( 306 return Bind<T>.builder(
300 init: init, 307 init: init,
  308 + create: create,
301 global: global, 309 global: global,
302 autoRemove: autoRemove, 310 autoRemove: autoRemove,
303 assignId: assignId, 311 assignId: assignId,
@@ -315,7 +323,7 @@ class _FactoryBind<T> extends Bind<T> { @@ -315,7 +323,7 @@ class _FactoryBind<T> extends Bind<T> {
315 @override 323 @override
316 Widget build(BuildContext context) { 324 Widget build(BuildContext context) {
317 return Binder<T>( 325 return Binder<T>(
318 - init: init, 326 + create: create,
319 global: global, 327 global: global,
320 autoRemove: autoRemove, 328 autoRemove: autoRemove,
321 assignId: assignId, 329 assignId: assignId,
@@ -367,9 +375,11 @@ class Binder<T> extends InheritedWidget { @@ -367,9 +375,11 @@ class Binder<T> extends InheritedWidget {
367 this.id, 375 this.id,
368 this.didChangeDependencies, 376 this.didChangeDependencies,
369 this.didUpdateWidget, 377 this.didUpdateWidget,
  378 + this.create,
370 }) : super(key: key, child: child); 379 }) : super(key: key, child: child);
371 380
372 final InitBuilder<T>? init; 381 final InitBuilder<T>? init;
  382 + final InstanceCreateBuilderCallback? create;
373 final bool global; 383 final bool global;
374 final Object? id; 384 final Object? id;
375 final String? tag; 385 final String? tag;
@@ -442,7 +452,7 @@ class BindElement<T> extends InheritedElement { @@ -442,7 +452,7 @@ class BindElement<T> extends InheritedElement {
442 452
443 _controllerBuilder = () => Get.find<T>(tag: widget.tag); 453 _controllerBuilder = () => Get.find<T>(tag: widget.tag);
444 } else { 454 } else {
445 - _controllerBuilder = widget.init; 455 + _controllerBuilder = widget.create?.call(this) ?? widget.init;
446 _isCreator = true; 456 _isCreator = true;
447 if (widget.lazy) { 457 if (widget.lazy) {
448 Get.lazyPut<T>(_controllerBuilder!, tag: widget.tag); 458 Get.lazyPut<T>(_controllerBuilder!, tag: widget.tag);
@@ -451,7 +461,7 @@ class BindElement<T> extends InheritedElement { @@ -451,7 +461,7 @@ class BindElement<T> extends InheritedElement {
451 } 461 }
452 } 462 }
453 } else { 463 } else {
454 - _controllerBuilder = widget.init; 464 + _controllerBuilder = widget.create?.call(this) ?? widget.init;
455 _isCreator = true; 465 _isCreator = true;
456 _needStart = true; 466 _needStart = true;
457 } 467 }
@@ -482,6 +492,10 @@ class BindElement<T> extends InheritedElement { @@ -482,6 +492,10 @@ class BindElement<T> extends InheritedElement {
482 _remove?.call(); 492 _remove?.call();
483 localController.addListener(filter); 493 localController.addListener(filter);
484 _remove = () => localController.removeListener(filter); 494 _remove = () => localController.removeListener(filter);
  495 + } else if (localController is StreamController) {
  496 + _remove?.call();
  497 + final stream = localController.stream.listen((_) => filter());
  498 + _remove = () => stream.cancel();
485 } 499 }
486 } 500 }
487 501
@@ -91,7 +91,7 @@ class _GetCache<S extends GetLifeCycleMixin> extends WidgetCache<GetWidget<S>> { @@ -91,7 +91,7 @@ class _GetCache<S extends GetLifeCycleMixin> extends WidgetCache<GetWidget<S>> {
91 widget!.controller.onDelete(); 91 widget!.controller.onDelete();
92 Get.log('"${widget!.controller.runtimeType}" onClose() called'); 92 Get.log('"${widget!.controller.runtimeType}" onClose() called');
93 Get.log('"${widget!.controller.runtimeType}" deleted from memory'); 93 Get.log('"${widget!.controller.runtimeType}" deleted from memory');
94 - GetWidget._cache[widget!] = null; 94 + // GetWidget._cache[widget!] = null;
95 }); 95 });
96 } 96 }
97 info = null; 97 info = null;
  1 +import 'dart:async';
1 import 'dart:collection'; 2 import 'dart:collection';
2 3
3 import 'package:flutter/foundation.dart'; 4 import 'package:flutter/foundation.dart';
@@ -23,6 +24,9 @@ class ListNotifierGroup = ListNotifier with ListNotifierGroupMixin; @@ -23,6 +24,9 @@ class ListNotifierGroup = ListNotifier with ListNotifierGroupMixin;
23 mixin ListNotifierSingleMixin on Listenable { 24 mixin ListNotifierSingleMixin on Listenable {
24 List<GetStateUpdate>? _updaters = <GetStateUpdate>[]; 25 List<GetStateUpdate>? _updaters = <GetStateUpdate>[];
25 26
  27 + int _version = 0;
  28 + int _microtaskVersion = 0;
  29 +
26 @override 30 @override
27 Disposer addListener(GetStateUpdate listener) { 31 Disposer addListener(GetStateUpdate listener) {
28 assert(_debugAssertNotDisposed()); 32 assert(_debugAssertNotDisposed());
@@ -57,8 +61,15 @@ mixin ListNotifierSingleMixin on Listenable { @@ -57,8 +61,15 @@ mixin ListNotifierSingleMixin on Listenable {
57 } 61 }
58 62
59 void _notifyUpdate() { 63 void _notifyUpdate() {
60 - for (var element in _updaters!) {  
61 - element(); 64 + if (_microtaskVersion == _version) {
  65 + _microtaskVersion++;
  66 + scheduleMicrotask(() {
  67 + _version++;
  68 + _microtaskVersion = _version;
  69 + for (var element in _updaters!) {
  70 + element();
  71 + }
  72 + });
62 } 73 }
63 } 74 }
64 75
1 import 'dart:async'; 1 import 'dart:async';
2 2
3 -import 'package:flutter/scheduler.dart';  
4 import 'package:flutter/widgets.dart'; 3 import 'package:flutter/widgets.dart';
5 4
6 import 'list_notifier.dart'; 5 import 'list_notifier.dart';
@@ -70,7 +69,7 @@ class _ValueBuilderState<T> extends State<ValueBuilder<T>> { @@ -70,7 +69,7 @@ class _ValueBuilderState<T> extends State<ValueBuilder<T>> {
70 } 69 }
71 } 70 }
72 71
73 -class ObxElement = StatelessElement with ObserverComponent; 72 +class ObxElement = StatelessElement with StatelessObserverComponent;
74 73
75 // It's a experimental feature 74 // It's a experimental feature
76 class Observer extends ObxStatelessWidget { 75 class Observer extends ObxStatelessWidget {
@@ -91,31 +90,13 @@ abstract class ObxStatelessWidget extends StatelessWidget { @@ -91,31 +90,13 @@ abstract class ObxStatelessWidget extends StatelessWidget {
91 } 90 }
92 91
93 /// a Component that can track changes in a reactive variable 92 /// a Component that can track changes in a reactive variable
94 -mixin ObserverComponent on ComponentElement { 93 +mixin StatelessObserverComponent on StatelessElement {
95 List<Disposer>? disposers = <Disposer>[]; 94 List<Disposer>? disposers = <Disposer>[];
96 95
97 void getUpdate() { 96 void getUpdate() {
98 - if (disposers != null) {  
99 - _safeRebuild();  
100 - }  
101 - }  
102 -  
103 - Future<bool> _safeRebuild() async {  
104 - if (dirty) return false;  
105 - if (SchedulerBinding.instance == null) {  
106 - markNeedsBuild();  
107 - } else {  
108 - // refresh was called during the building  
109 - if (SchedulerBinding.instance!.schedulerPhase != SchedulerPhase.idle) {  
110 - // Await for the end of build  
111 - await SchedulerBinding.instance!.endOfFrame;  
112 - if (dirty) return false;  
113 - }  
114 - 97 + if (disposers != null && !dirty) {
115 markNeedsBuild(); 98 markNeedsBuild();
116 } 99 }
117 -  
118 - return true;  
119 } 100 }
120 101
121 @override 102 @override
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: 5.0.0-beta.45 3 +version: 5.0.0-beta.50
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment: