-
Notifications
You must be signed in to change notification settings - Fork 26
/
app_scope.dart
56 lines (47 loc) · 1.36 KB
/
app_scope.dart
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import 'package:analytics/core/analytyc_service.dart';
import 'package:dio/dio.dart';
import 'package:flutter_template/common/utils/logger/i_log_writer.dart';
import 'package:flutter_template/config/app_config.dart';
import 'package:flutter_template/config/environment/environment.dart';
import 'package:shared_preferences/shared_preferences.dart';
/// {@template app_scope.class}
/// Scope of dependencies which are needed through the whole app's life.
/// {@endtemplate}
final class AppScope implements IAppScope {
@override
final Environment env;
@override
final AppConfig appConfig;
@override
final SharedPreferences sharedPreferences;
@override
final Dio dio;
@override
final AnalyticService analyticsService;
@override
final ILogWriter logger;
/// {@macro app_scope.class}
const AppScope({
required this.env,
required this.appConfig,
required this.sharedPreferences,
required this.dio,
required this.analyticsService,
required this.logger,
});
}
/// {@macro app_scope.class}
abstract interface class IAppScope {
/// Environment.
Environment get env;
/// App configuration.
AppConfig get appConfig;
/// Http client.
Dio get dio;
/// Shared preferences.
SharedPreferences get sharedPreferences;
/// Logger.
ILogWriter get logger;
/// Analytics sending service.
AnalyticService get analyticsService;
}