0

I was using ObjectBox without many problems for a while during a development with Flutter, but now the build_runner fails:

  1. The closest change I have made is a Flutter upgrade yesterday to Flutter 2.5.3 along with Dart 2.14.4.

  2. ObjectBox dependencies in pubspec.yaml are:

    objectbox: ^1.2.0  
    objectbox_flutter_libs: any
    
  3. Now, although the objectbox-model.json file is there, the objectbox.g.dart file is missing and does not get regenerated.

  4. I then tried to run the two example projects give in the official OB documents, but those failed too with similar results (they ran OK before this).

The complete build stack is as follows:'

Microsoft Windows [Version 10.0.19042.1237] (c) Microsoft Corporation. All rights reserved.
D:\learnedfriend>flutter pub run build_runner watch --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 462ms
[INFO] Setting up file watchers...
[INFO] Setting up file watchers completed, took 11ms
[INFO] Waiting for all file watchers to be ready...
[INFO] Waiting for all file watchers to be ready completed, took 358ms
[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 126ms
[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 6.3s
[INFO] Running build...
[INFO] Running build completed, took 14ms
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 54ms
[SEVERE] objectbox_generator:generator on lib/$lib$ (cached):
Bad state: lastRelationId 4:6834778133563033891 does not match any standalone relation
[SEVERE] Failed after 85ms
karel
  • 5,489
  • 46
  • 45
  • 50
ViKARLL
  • 101
  • 1
  • 9

1 Answers1

0

I have found a solution to this problem and am posting it for the benefit of whoever encounters the same issue in future.

You should manually delete the objectbox-model.json file and objectbox.g.dart (if it still exists) and run the command "flutter pub run build_runner watch --delete-conflicting-outputs" at the project folder (without quotes, of course).

Also, it has to be mentioned that, as at the time of writing this post, if ObjectBox is a contemplated choice for your persistence, please be wary that (although it is an excellent package), support for a problem if you get stuck is very low to nil, in stackoverflow. I have not seen more than 2 or 3 contributors and if your question escapes their attention, you are pretty much on your own!

ViKARLL
  • 101
  • 1
  • 9