generated from nain93/flutter_boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 해시태그뷰 api 타입수정 및 페이지네이션
- Loading branch information
Showing
25 changed files
with
797 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:moa_app/models/content_model.dart'; | ||
import 'package:moa_app/repositories/content_repository.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'content_detail_provider.g.dart'; | ||
|
||
@riverpod | ||
class ContentDetail extends _$ContentDetail { | ||
Future<ContentModel> fetchItem({required String contentId}) async { | ||
// get the [KeepAliveLink] | ||
var link = ref.keepAlive(); | ||
// a timer to be used by the callbacks below | ||
Timer? timer; | ||
// An object from package:dio that allows cancelling http requests | ||
// When the provider is destroyed, cancel the http request and the timer | ||
ref.onDispose(() { | ||
timer?.cancel(); | ||
}); | ||
// When the last listener is removed, start a timer to dispose the cached data | ||
ref.onCancel(() { | ||
// start a 30 second timer | ||
timer = Timer(const Duration(seconds: 30), () { | ||
// dispose on timeout | ||
link.close(); | ||
}); | ||
}); | ||
// If the provider is listened again after it was paused, cancel the timer | ||
ref.onResume(() { | ||
timer?.cancel(); | ||
}); | ||
|
||
var data = | ||
await ContentRepository.instance.getContentDetail(contentId: contentId); | ||
return data; | ||
} | ||
|
||
@override | ||
Future<ContentModel?> build() async { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:moa_app/models/content_model.dart'; | ||
import 'package:moa_app/repositories/folder_repository.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'folder_detail_provider.g.dart'; | ||
|
||
/// AsyncNotifierProvider | ||
// @Riverpod(keepAlive: true) | ||
@riverpod | ||
class FolderDetail extends _$FolderDetail { | ||
Future<List<ContentModel>> fetchItem({required String folderName}) async { | ||
// get the [KeepAliveLink] | ||
var link = ref.keepAlive(); | ||
// a timer to be used by the callbacks below | ||
Timer? timer; | ||
// An object from package:dio that allows cancelling http requests | ||
// When the provider is destroyed, cancel the http request and the timer | ||
ref.onDispose(() { | ||
timer?.cancel(); | ||
}); | ||
// When the last listener is removed, start a timer to dispose the cached data | ||
ref.onCancel(() { | ||
// start a 30 second timer | ||
timer = Timer(const Duration(seconds: 30), () { | ||
// dispose on timeout | ||
link.close(); | ||
}); | ||
}); | ||
// If the provider is listened again after it was paused, cancel the timer | ||
ref.onResume(() { | ||
timer?.cancel(); | ||
}); | ||
|
||
var data = | ||
FolderRepository.instance.getFolderDetailList(folderName: folderName); | ||
return data; | ||
} | ||
|
||
@override | ||
Future<void> build() async {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.