Duplicate Properties in my state while in a riverpod provider #3604
Unanswered
PhilipHuang2
asked this question in
Q&A
Replies: 1 comment
-
That's just the debugger getting confused. There's no field duplicate |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I am creating a AsyncNotifierProvider in Riverpod that holds a list of reviews alongside a bunch of memory variables for a complicated way of processing them. I decided to wrap the entire thing in a freezed class, and am encountering a wierd bug.
When I try to debug my code, all my variables are doubled in my class. I would have two list of reviews, and two length variables and so on and so forth, and even two value properties in my state.
See Image below.
![image](https://private-user-images.githubusercontent.com/5439889/338013886-4e4a1838-2066-4698-adea-2f71071bff0c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMjY1NjgsIm5iZiI6MTczOTMyNjI2OCwicGF0aCI6Ii81NDM5ODg5LzMzODAxMzg4Ni00ZTRhMTgzOC0yMDY2LTQ2OTgtYWRlYS0yZjcxMDcxYmZmMGMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMDIxMTA4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjkwMjMyYmU2YmIzYTQ1NTg3NzBlN2Q4MDRjNDQ4NzEwNWViYzdiMDE5NGQxYmM5YWVlNTliZDBhOTkwMTdiYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.lysN9loqnL__4nMvNziFuJOyY5112uTihhuRdEGXlWo)
I am a bit confused by all this since this is my first time using both freezed and riverpod.
I actually have both my freezed code, and my Riverpod code code in the same file and maybe thats what causing the issue,
Here is my code below
In addition it seems like my update function does not work either, most likely because I have two value properties.
Example below.
I don't really know what is going on, but I have two assumptions. Because I am using code generation for both freezed and riverpod in the same folder, the generation causes the files to loop into each other cause a second copy of the riverpod state when using the freezed class.
Or I tend to call the provider again when inside of a function to either access the state or its functions after watching it in the build function so I don't have to pass things over, and maybe that duplicating the state as well?
Any advice would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions