Comments (2)
Thanks for filing the issue.
We will take a look at this as soon as we're back at work. It's easter break so will only be back on open source duty on Tuesday next week.
from stacked.
Hello @GlizzyHacker, I will try to help you. I think this is not a bug and we should, probably, deprecate createNewViewModelOnInsert
.
The problem is that when you navigate back, the view and their viewmodel are pulled out of the tree, no matter if we dispose of it or not. Because of that, despite we can avoid disposing of the viewmodel, we lost the reference to it.
The solution to solve this problem is to use the locator for the ViewModel to persist the reference to it.
Steps to fix the problem:
- Add the following line to dependencies at @StackedApp annotation in the app.dart file.
LazySingleton(classType: HomeViewModel),
- Run stacked generate command
- On HomeView, return HomeViewModel through the locator on viewModelBuilder like below
@override
HomeViewModel viewModelBuilder(
BuildContext context,
) => locator<HomeViewModel>();
Let me know if that doesn't work for you and I will re-open the issue.
issue-1095-demo.mp4
from stacked.
Related Issues (20)
- [bug]: Error when running stacked create service HOT 5
- [feature]: Add --no-test flag to stacked create commands HOT 3
- [feature]: Customizable Logger Filters for StackedLogger HOT 1
- [bug]: Generated form with only drop down form fields has missing methods and multiple errors HOT 1
- [bug]: build runner failing on Stacked-generator-1.6.1-pre.1 HOT 3
- [bug]: isBottomSheetOpen HOT 4
- [bug]: replaceWithTransition doesn't work as expected HOT 2
- how i can navigate to any screen if my app is in the terminated state? HOT 1
- [feature]: WebAssembly (Wasm) Support HOT 4
- Generator not working for routes HOT 4
- [feature]: Google Cloud Logging Output Target for Stacked Logger HOT 3
- [feature]: Lazy construct RouteGuards
- [bug]: Unexpected app re-initialization on web page reload when using Stacked architecture
- [bug]: Navigate to a View with Arguments crashes WEB app when browser page is reloaded HOT 6
- [feature]: add format process on generate command HOT 7
- access to RouteAwareStateMixin ?
- [docs]: HOw to achive this MaterialRoute(page: StartupView, initial: true, path: '/:uiD?', ), // Optional parameter route
- [bug]: Files missing on new app creation HOT 1
- [bug]: CupertinoRoute do not respect PopScope when allowing swipe-to-dismiss
- [feature]: Asserting values are present when viewmodel.dataReady is true
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stacked.