File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import 'dart:async' ;
2+
3+ import 'package:flutter/foundation.dart' ;
4+ import 'package:flutter/material.dart' ;
5+ import 'package:hive_flutter/hive_flutter.dart' ;
6+ import 'package:hydrated_bloc/hydrated_bloc.dart' ;
7+ import 'package:path_provider/path_provider.dart' ;
8+
9+ import 'data/constants/strings.dart' ;
10+ import 'presentation/core/main_app.dart' ;
11+
12+ Future <void > main () async {
13+ // Necessary if you intend to initialize in an async function.
14+ WidgetsFlutterBinding .ensureInitialized ();
15+
16+ await _initHive ();
17+ final hydratedStorage = await _initHydratedBloc ();
18+
19+ // Zone for Hydrated Bloc.
20+ HydratedBlocOverrides .runZoned (
21+ () async => runApp (await Codephile .run ()),
22+ storage: hydratedStorage,
23+ );
24+ }
25+
26+ Future <void > _initHive () async {
27+ await Hive .initFlutter ();
28+ await Hive .openBox (AppStrings .hiveBoxName);
29+ }
30+
31+ Future <Storage > _initHydratedBloc () async {
32+ return HydratedStorage .build (
33+ storageDirectory: kIsWeb
34+ ? HydratedStorage .webStorageDirectory
35+ : await getApplicationSupportDirectory (),
36+ );
37+ }
File renamed without changes.
You can’t perform that action at this time.
0 commit comments