Skip to content

Commit

Permalink
#4 controller: postContoller provider
Browse files Browse the repository at this point in the history
  • Loading branch information
surajadkhari committed Aug 20, 2022
1 parent f2a0e3c commit 3ddc906
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/features/presentation/controllers/post_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import 'package:fetch_api_with_proper_architecure/features/data/models/post_resp
import 'package:fetch_api_with_proper_architecure/features/respository/post_respository.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final postControllerProvider =
StateNotifierProvider<PostController, AsyncValue<List<PostResponseModel>>>(
(ref) {
return PostController(ref.watch(repoPostProvider));
});

class PostController
extends StateNotifier<AsyncValue<List<PostResponseModel>>> {
PostController(this._postRepository) : super(const AsyncValue.loading()) {
Expand Down

0 comments on commit 3ddc906

Please sign in to comment.