title: Flutter: fields of an object added to a Hive box returns null after app restart
body: <p>I'm creating an app with Flutter and Hive but I'm not familiar with it yet.<br />
  I need to have an initial account in it, so I've made a Hive box for that and I'm trying to save an account object in that box. <br />
  I check adding with prints and it saved the object in box correctly. But when I restart the app, the print no longer returns the values. Object is still there, but only the String name field has a value, and the other two are nulls. <br />
  Why some fields are nulls after the restart?</p>
  <p>Output after first run</p>
  <pre><code>I/flutter (14014): wallet
  I/flutter (14014): Currencies.USD
  I/flutter (14014): 0.0
  </code></pre>
  <p>Output after restart</p>
  <pre><code>I/flutter (14014): wallet
  I/flutter (14014): null
  I/flutter (14014): null
  </code></pre>
  <p>Main code</p>
  <pre><code>void main() async {
    WidgetsFlutterBinding.ensureInitialized();
    Directory document = await getApplicationDocumentsDirectory();
  
    Hive.registerAdapter(CurrenciesAdapter());
    Hive.registerAdapter(AccountAdapter());
    Hive.init(document.path);
  
    final accountBox = await Hive.openBox&lt;Account&gt;('accounts');
  
    if (accountBox.length == 0) { // default wallet
      Account wallet = new Account(&quot;wallet&quot;, Currencies.USD);
      accountBox.add(wallet);
    }
  
    print(accountBox.getAt(0).name.toString());
    print(accountBox.getAt(0).currency.toString());
    print(accountBox.getAt(0).cashAmount.toString());
  
    runApp(MyApp());
  }
  </code></pre>
  <p>Account class code</p>
  <pre><code>import 'package:hive/hive.dart';
  
  part 'account.g.dart';
  
  @HiveType(typeId: 0)
  class Account {
    @HiveField(0)
    String name;
    @HiveField(1)
    Currencies currency;
    @HiveField(2)
    double cashAmount;
  
    Account(String name, Currencies currency){
      this.name = name;
      this.currency = currency;
      this.cashAmount = 0;
    }
  }
  
  @HiveType(typeId: 1)
  enum Currencies {
    USD, EUR, PLN
  }
  
  </code></pre>