Files
video/app/lib/main.dart
T
2026-10-16 13:51:00 +08:00

40 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 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:media_kit/media_kit.dart';
import 'core/storage/local_store.dart';
import 'core/storage/search_history_store.dart';
import 'core/storage/watch_dedup_store.dart';
import 'core/theme/app_theme.dart';
import 'router.dart';
/// App 入口:本地存储 + MediaKit + MaterialApp.router
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// MediaKit(libmpv 底层)全局初始化:每个进程必须且仅调一次
MediaKit.ensureInitialized();
// 本地存储初始化(设备指纹在 splash 阶段生成)
await LocalStore.init();
// 搜索历史(本地,不上报服务端)
await SearchHistoryStore.init();
// 观看上报去重(持久化;不初始化则观看计费/游客免费额度链路失效)
await WatchDedupStore.init();
runApp(const ProviderScope(child: VideoApp()));
}
class VideoApp extends ConsumerWidget {
const VideoApp({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final router = ref.watch(routerProvider);
return MaterialApp.router(
title: '短视频',
debugShowCheckedModeBanner: false,
theme: AppTheme.dark,
routerConfig: router,
);
}
}