Skip to content
Snippets Groups Projects
Commit 520275dd authored by vjrj's avatar vjrj
Browse files

Reorder start up code. Use of PackageInfo for sending version to sentry

parent 02228703
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ import 'package:hive_flutter/hive_flutter.dart'; ...@@ -11,6 +11,7 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart'; import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:introduction_screen/introduction_screen.dart'; import 'package:introduction_screen/introduction_screen.dart';
import 'package:once/once.dart'; import 'package:once/once.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:responsive_framework/responsive_wrapper.dart'; import 'package:responsive_framework/responsive_wrapper.dart';
import 'package:responsive_framework/utils/scroll_behavior.dart'; import 'package:responsive_framework/utils/scroll_behavior.dart';
...@@ -39,7 +40,6 @@ void main() async { ...@@ -39,7 +40,6 @@ void main() async {
/// Initialize packages /// Initialize packages
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized(); await EasyLocalization.ensureInitialized();
Bloc.observer = AppBlocObserver();
if (!kIsWeb && Platform.isAndroid) { if (!kIsWeb && Platform.isAndroid) {
await FlutterDisplayMode.setHighRefreshRate(); await FlutterDisplayMode.setHighRefreshRate();
...@@ -57,7 +57,8 @@ void main() async { ...@@ -57,7 +57,8 @@ void main() async {
assert(shared.getPubKey() != null); assert(shared.getPubKey() != null);
if (kIsWeb) { if (kIsWeb) {
await Hive.initFlutter(); // It seems is redundant
// await Hive.initFlutter();
HydratedBloc.storage = await HydratedStorage.build( HydratedBloc.storage = await HydratedStorage.build(
storageDirectory: HydratedStorage.webStorageDirectory); storageDirectory: HydratedStorage.webStorageDirectory);
} else { } else {
...@@ -67,6 +68,8 @@ void main() async { ...@@ -67,6 +68,8 @@ void main() async {
await HydratedStorage.build(storageDirectory: tmpDir); await HydratedStorage.build(storageDirectory: tmpDir);
} }
Bloc.observer = AppBlocObserver();
// Reset hive during developing // Reset hive during developing
if (!kReleaseMode) { if (!kReleaseMode) {
// Once.clearAll(); // Once.clearAll();
...@@ -98,13 +101,17 @@ void main() async { ...@@ -98,13 +101,17 @@ void main() async {
BlocProvider<ContactsCubit>( BlocProvider<ContactsCubit>(
create: (BuildContext context) => ContactsCubit()), create: (BuildContext context) => ContactsCubit()),
BlocProvider<TransactionsCubit>( BlocProvider<TransactionsCubit>(
create: (BuildContext context) => TransactionsCubit()) create: (BuildContext context) => TransactionsCubit()),
// Add other BlocProviders here if needed // Add other BlocProviders here if needed
], child: const GinkgoApp()), ], child: const GinkgoApp()),
), ),
); );
final String version = getAppVersion(); final PackageInfo packageInfo = await PackageInfo.fromPlatform();
final String version = packageInfo.version;
logger('G1nkgo version: $version');
if (kReleaseMode) { if (kReleaseMode) {
// Only use sentry in production // Only use sentry in production
await SentryFlutter.init(( await SentryFlutter.init((
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment