Replies: 1 comment 1 reply
-
There's SignalProvider but it doesn't seem to support You can couple it with Provider or lite_ref to achieve that. final selectedStocksRef = Ref.scoped(
(_) => listSignal(<Stock>[]),
dispose: (instance) => instance.dispose(),
);
void main() {
runApp(LiteRefScope(child: MyApp()));
}
class DetailsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final selectedStocks = selectedStocksRef.of(context);
//... rest of build method ... //
}
} The list signal will be disposed when |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a listSignal and i want it to reset to its initial state after i close the screen (local state)
this is what i'm currently doing but i don't want to use StatefulWidget everywhere, is there any better approach?
Beta Was this translation helpful? Give feedback.
All reactions