1

I get the failure

[SEVERE] objectbox_generator:generator on lib/$lib$:

FormatException: Unexpected end of input (at character 1)

^

[INFO] Running build completed, took 3.9s
[INFO] Caching finalized dependency graph completed, took 529ms
[SEVERE] Failed after 4.5s

I condensed my class already to

import 'package:objectbox/objectbox.dart';
@Entity()
class CleaningJobObjectBox {
  @Id()
  int id = 0;
  final String jobId = "";
}

What can I do?

w461
  • 2,168
  • 4
  • 14
  • 40
  • provide more details – Vikash Kumar Nov 19 '22 at 11:19
  • what detail are you thinking about. Unfortunately the exception does not provide more detail. I also copied the `User` example of https://docs.objectbox.io/getting-started, same error. If I remove the `@Entity()` the build_runner runs successfully. The only deviation from standard might be that the file sits inside a `package`, not directly in the project lib. However, I start the build_runner from `package/data` – w461 Nov 19 '22 at 11:35
  • In the main project, the same file with `User` works fine, so it seems to be related with doing this for a package – w461 Nov 19 '22 at 11:48

2 Answers2

0
@Entity()
class CleaningJobObjectBox{
@Id()
int id = 0;
  final String jobId;

  CleaningJobObjectBox({required this.jobId});
}

Use this - flutter pub run build_runner build --delete-conflicting-outputs

Vikash Kumar
  • 103
  • 3
  • 9
  • Thanks, the `--delete-conflicting-outputs` does not help. unfortunately. And it cannot be the class or the ObjectBox tags themselves because I can build in the root lib of my project but when I copy this file to the package lib, it no longer works. ObjectBox is properly set up in the package as far as I can tell (dependencies and bash command) – w461 Nov 19 '22 at 15:54
0

I used the wrong build runner. While fixing some issues and copying code from a Dart package to the flutter app and vice versa, I accidentally used flutter pub run build_runner build instead of dart run build_runner build of the Flutter app also for my Dart package - and did not notice for quite a while

w461
  • 2,168
  • 4
  • 14
  • 40