Assertions for Invalid Riverpod Syntax #1202
whitemagehealing
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
As an assert, it's not really possible. With custom lint rules, it's possible though. But that's more complex, so it'll take time before these are available |
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'm sorry if this does not make sense or isn't even possible in Dart, but should there be asserts for the following inside of StateNotifier?
no state.copyWith() detected for whatever type state is.
// Not sure if detecting lack of an interface implementation is possible in ANOTHER class.
state.mylist[state.mylist.length - 1] = 27;
// should either automatically realize a copy for everything and only change this one param OR just assert that something that is immutable shouldn't be mutated. It seems silly to write a whole new temporary list, change that one value and pass it all into the copyWith(); however, I'm guessing that this is a current limitation with Dart. I have @immutable over my state class, but no error or assert is thrown. :(
state is not detected as immutable.
// Again, maybe this is just all not possible yet, and is a limitation of Dart.
I understand if these are all limitations of Dart, but if Dart somehow removes these limitations, do these sound like reasonable expectations?
Beta Was this translation helpful? Give feedback.
All reactions