Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (27 sloc) 561 Bytes
import 'dart:io';
import 'package:hive/hive.dart';
part 'main.g.dart';
class Person {
String name;
int age;
List<String> friends;
String toString() {
return '$name: $age';
void main() async {
var path = Directory.current.path;
var box = await Hive.openBox('testBox');
var person = Person() = 'Dave'
..age = 22
..friends = ['Linda', 'Marc', 'Anne'];
box.put('dave', person);
print(box.get('dave')); // Dave: 22
You can’t perform that action at this time.