티스토리 뷰

반응형

기존에 작성한 코드에서 Riverpod 의 StateProvider 를 이용한 것이 있는데, 이 코드를 Riverpod Generator 를 활용하는 코드로 migration 하려고 보았더니 Generator 에서는 State Provider는 지원하지 않는다. 

 

어떤 질문자가 아래와 같이 문의를 했는데, 

 

레미의 답변은

 

제네레이터에서 StateProvider 같은 것을 추가할 계획은 아직 없고,

사용할 State를 Class 로 선언하고 이 클래스를 이용하여 Notifier 로 프로바이더를 만들어야 한다고 한다. 간단한 예제는 아래 링크에서 참고하면된다 

https://codewithandrea.com/articles/flutter-riverpod-async-notifier/#notifier-with-riverpod-generator

 

How to use Notifier and AsyncNotifier with the new Flutter Riverpod Generator

A step-by-step guide showing how to migrate StateProvider and StateNotifier to the new Notifier and AsyncNotifier classes (StreamNotifier is covered too).

codewithandrea.com

 

 

 

출처: https://github.com/rrousselGit/riverpod/discussions/1725

반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함