Replies: 1 comment 3 replies
-
It is recommended to use |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi !
I have recently looked into several solutions for flutter state management.
Getx, states_rebuilder. and spent last 2 days for flutter_riverpod.
codes below are just simple for class with 1 member only.
==========
import 'package:flutter_riverpod/flutter_riverpod.dart';
class Watched {
int? count ;
Watched({ this.count});
Watched add(int value){
return Watched(count:value);
}
}
class Snotifier extends StateNotifier{
Snotifier():super(Watched(count: 0)) ;
void plus(){
print("here");
state= state.add(state.count!+1);
print(state.count);
}
}
final snProvider = StateNotifierProvider<Snotifier, Watched>((ref){
return Snotifier();
});
As you read, riverpod needs those code for 1 object with 1 member only.
and if that class have 1 more member, riverpod needs 2 times codes.
That is just my guessing at the third day of studying riverpod.
As those members increase, riverpod needs equatable, freezed,,, .
My guessing is correct ?
Beta Was this translation helpful? Give feedback.
All reactions