diff --git a/packages/flutter_rearch/lib/src/side_effects/animation.dart b/packages/flutter_rearch/lib/src/side_effects/animation.dart index 10ca7b8..d7bd164 100644 --- a/packages/flutter_rearch/lib/src/side_effects/animation.dart +++ b/packages/flutter_rearch/lib/src/side_effects/animation.dart @@ -70,7 +70,7 @@ AnimationController _animationController( }) { vsync ??= use.singleTickerProvider(); - final controller = use.memo( + return use.disposable( () => AnimationController( vsync: vsync!, duration: duration, @@ -81,12 +81,8 @@ AnimationController _animationController( animationBehavior: animationBehavior, value: initialValue, ), - ); - use.effect(() => controller.dispose, [controller]); - - controller + (controller) => controller.dispose(), + ) ..duration = duration ..reverseDuration = reverseDuration; - - return controller; } diff --git a/packages/flutter_rearch/lib/src/side_effects/text_editing_controller.dart b/packages/flutter_rearch/lib/src/side_effects/text_editing_controller.dart index a7b6f21..ec3ac82 100644 --- a/packages/flutter_rearch/lib/src/side_effects/text_editing_controller.dart +++ b/packages/flutter_rearch/lib/src/side_effects/text_editing_controller.dart @@ -4,7 +4,8 @@ TextEditingController _textEditingController( WidgetSideEffectRegistrar use, { String? initialText, }) { - final controller = use.memo(() => TextEditingController(text: initialText)); - use.effect(() => controller.dispose, [controller]); - return controller; + return use.disposable( + () => TextEditingController(text: initialText), + (controller) => controller.dispose(), + ); }