0

This is my model class

@Entity()
@Sync()
class Account{
  int id = 0;
  String? name;
  int? age;
  String? gender;

  logAccount() => 'Account{id: $id, name: $name}';

}

And after I run flutter pub run build_runner build, I got a generate file and function openStore is

Store openStore(
        {String? directory,
        int? maxDBSizeInKB,
        int? fileMode,
        int? maxReaders,
        bool queriesCaseSensitiveDefault = true,
        String? macosApplicationGroup}) =>
    Store(getObjectBoxModel(),
        directory: directory,
        maxDBSizeInKB: maxDBSizeInKB,
        fileMode: fileMode,
        maxReaders: maxReaders,
        queriesCaseSensitiveDefault: queriesCaseSensitiveDefault,
        macosApplicationGroup: macosApplicationGroup);

And basically this function isn't Future type and the tutorial got await it to open it? Did i miss something? or is this a safe way to create box like this, because it seems work with dev not the release type? Thanks!

  • Do you have the objectbox_flutter_libs dependency added? If it's missing this method is not a future (e.g. for Dart command line apps). – Uwe - ObjectBox Oct 04 '22 at 14:31

0 Answers0