import 'package:cheminova/screens/splash_screen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hive_flutter/adapters.dart';

import 'firebase_options.dart';

var box;
void main()async{

  WidgetsFlutterBinding.ensureInitialized();
  // Ensure that Flutter's binding is initialized before running the app, necessary for async operations before runApp

  // Initialize Firebase with the current platform's configuration
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  await Hive.initFlutter();  // Initialize Hive for Flutter
  await Hive.openBox('cartBox');
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    // Use GetMaterialApp for navigation and state management with GetX
    return const GetMaterialApp(
      debugShowCheckedModeBanner: false,
      home: SplashScreen(),
    );
  }
}
