1

I registered my ObjectBox Store as a LazySingleton with this method

setupLocatorAdditions() async {
  stackedAdditionLocator.registerLazySingletonAsync<Store>(() => openStore());
}

Which worked fine. But after multiple rebuilds from the BuildRunner the ObjectBox Generator threw this error, regardless of whether I removed the singleton registration and reran it.

lib/objectbox.g.dart:1341:67: Error: No named parameter with the name 'lazy'.
              weekDays: const fb.ListReader<int>(fb.Int8Reader(), lazy: false)
                                                                  ^^^^
../../Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/objectbox-1.1.1/lib/flatbuffers/flat_buffers.dart:994:9: Context: Found this candidate, but the arguments don't match.
  const ListReader(this._elementReader);
        ^^^^^^^^^^

lib/objectbox.g.dart:1343:68: Error: No named parameter with the name 'lazy'.
              locations: const fb.ListReader<int>(fb.Int8Reader(), lazy: false)
                                                                   ^^^^
../../Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/objectbox-1.1.1/lib/flatbuffers/flat_buffers.dart:994:9: Context: Found this candidate, but the arguments don't match.

  const ListReader(this._elementReader);
        ^^^^^^^^^^
2

FAILURE: Build failed with an exception.

DJ2695
  • 62
  • 2
  • 6

1 Answers1

1

That argument isn't part of the released objectbox-dart v1.1.1 (it was added by this commit 13 days ago while v1.1.1 was released 19 days ago).

Looks like you're using a mismatching generator? Can you check your pubspec.yaml if you're using a dependency override on objectbox_generator, e.g. from git? If you're using a dependency override you should stick to a specific commit and make sure you use it on both generator and objectbox library itself. If you don't need the dependency override, just remove it from your pubspec.yaml.

In both cases, run pub get after making the changes and pub run build_runner build.

vaind
  • 1,642
  • 10
  • 19
  • yeah I just used the dependency override for the generator you suggest in my last thread, but didn't override objectbox package. I now referenced the same commit for this package and it worked like it should. Thank you once more – DJ2695 Jul 28 '21 at 08:03