Skip to content

Instantly share code, notes, and snippets.

@nbnD
Created August 4, 2022 11:48
Show Gist options
  • Select an option

  • Save nbnD/6a56f2ff84a480e37d224552e6e6d7c2 to your computer and use it in GitHub Desktop.

Select an option

Save nbnD/6a56f2ff84a480e37d224552e6e6d7c2 to your computer and use it in GitHub Desktop.

Revisions

  1. nbnD created this gist Aug 4, 2022.
    32 changes: 32 additions & 0 deletions main.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    import 'dart:io';

    import 'package:flutter/material.dart';
    import 'package:hive/hive.dart';
    import './data_model.dart';
    import 'package:path_provider/path_provider.dart' as pathProvider;

    import 'homepage.dart';

    void main() async {
    WidgetsFlutterBinding.ensureInitialized();
    Directory directory = await pathProvider.getApplicationDocumentsDirectory();
    Hive.init(directory.path);
    Hive.registerAdapter(DataModelAdapter());
    await Hive.openBox('hive_box');
    runApp(const MyApp());
    }

    class MyApp extends StatelessWidget {
    const MyApp({Key? key}) : super(key: key);

    @override
    Widget build(BuildContext context) {
    return MaterialApp(
    title: 'Flutter Demo',
    theme: ThemeData(
    primarySwatch: Colors.blue,
    ),
    home: const HomePage(),
    );
    }
    }