Files
observer/flutter_app/lib/container.dart
T
2026-09-07 10:11:36 +08:00

39 lines
1.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'annotate/annotate_api.dart';
import 'auth/auth_view_model.dart';
import 'auth/session_store.dart';
import 'home/home_view_model.dart';
import 'payment/license_service.dart';
import 'payment/models.dart';
import 'payment/order_api.dart';
import 'payment/paywall_view_model.dart';
import 'payment/payment_service.dart';
/// 手动依赖注入容器(对应原 Kotlin AppContainer
class AppContainer {
late final SessionStore sessionStore;
late final OrderApi orderApi;
late final LicenseService licenseService;
late final AuthViewModel authViewModel;
late final HomeViewModel homeViewModel;
late final PaywallViewModel paywallViewModel;
late final AnnotateApi annotateApi;
AppContainer() {
sessionStore = SessionStore();
orderApi = OrderApi(sessionStore: sessionStore);
licenseService =
LicenseService(orderApi: orderApi, sessionStore: sessionStore);
authViewModel = AuthViewModel(orderApi: orderApi, sessionStore: sessionStore);
homeViewModel = HomeViewModel(licenseService: licenseService);
paywallViewModel = PaywallViewModel(
orderApi: orderApi,
licenseService: licenseService,
services: {
PayChannel.wechat: WechatPayService(orderApi: orderApi),
PayChannel.alipay: AlipayService(orderApi: orderApi),
},
);
annotateApi = AnnotateApi(sessionStore: sessionStore);
}
}