-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure on page reload #182
Comments
Has anyone seen this error before? Is there more information that I should provide to help diagnose? Here are my dependencies:
|
I am reluctantly supporting Flutter Web because it's awful. Looks like a wrong cast, I'll try to reproduce soon. |
As I was tracing my code, I came across this observation. On the initial load in the model.g.dart file, the data getting passed in is a _jsonMap. On the reload, the data coming in is a Map<String, dynamic>. I assume the difference is that the first load comes from the API and the second one comes from the Hive Box? But it seems like it should always pass the same type. I thought the first load would be loaded into Hive and my code actually accessed that Hive Box. But there is definitely a difference of the types depending on which load is occurring. Also, I realized I may have omitted a key piece of information. My model is a composite. In other words, the top level object contains a list of sub-objects. These are not sub-resources. There is no API to access them independently from the top level resource. When the top level resource is requested it contains the complete list of the sub-objects. The top level is @DataRepository and @JsonSerializable. But the sub-object is just @JsonSerializable because I didn't need the framework to treat them as a indpendent resource. The failure is actually occuring on the sub-object (Layer) deserialization. I have attached a portion of my code to illustrate: In case it is relevant, the database is MongoDB.
|
I should be able to look at this next week. It would be great if you found a workaround in the meantime. |
Any progress? I did find a workaround. I have to sync local storage all the time. For some reason, when syncing, it takes as long to hot reload as it does to stop and start the application in debug. |
No, I couldn't look at this in detail yet. What do you mean by "sync local storage all the time"? Can you share some code? Maybe that gives me a pointer to fix this faster. |
First load of my Flutter web app utilizing flutter_data works just fine. If I reload the page via the web browser, I receive the following:
I've searched but cannot find this issue answered anywhere.
The text was updated successfully, but these errors were encountered: