mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-22 09:30:45 +00:00
feat(app): Добавить пример со Scope (#5)
* feat(app): Добавить пример со Scope * fix scope * feat: добавить скоуп с внутренней зависимостью от репозитория (#6) Co-authored-by: Artem Barkalov <artembark@gmail.com> * feat: исправить обалсть видимости ProfileScope * feat: добавить фикс namespace плагинов --------- Co-authored-by: PetrovY <y.petrov@friflex.com> Co-authored-by: Artem Barkalov <artembark@gmail.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import '../../domain/repository/i_profile_repository.dart';
|
||||
|
||||
/// {@template ProfileMockRepository}
|
||||
///
|
||||
/// {@endtemplate}
|
||||
final class ProfileMockRepository implements IProfileRepository {
|
||||
@override
|
||||
String get name => 'ProfileMockRepository';
|
||||
|
||||
@override
|
||||
Future<String> fetchUserProfile(String id) {
|
||||
return Future.value('MOCK Yura Petrov');
|
||||
}
|
||||
}
|
||||
24
lib/features/profile/data/repository/profile_repository.dart
Normal file
24
lib/features/profile/data/repository/profile_repository.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:friflex_starter/app/http/i_http_client.dart';
|
||||
|
||||
import '../../domain/repository/i_profile_repository.dart';
|
||||
|
||||
/// {@template ProfileRepository}
|
||||
///
|
||||
/// {@endtemplate}
|
||||
final class ProfileRepository implements IProfileRepository {
|
||||
final IHttpClient httpClient;
|
||||
|
||||
ProfileRepository({required this.httpClient});
|
||||
|
||||
@override
|
||||
String get name => 'ProfileRepository';
|
||||
|
||||
@override
|
||||
Future<String> fetchUserProfile(String id) async {
|
||||
// Какой-то запрос к серверу
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
// httpClient.get('https://example.com/profile/$id');
|
||||
|
||||
return 'Yura Petrov';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user