ObjectBox Failure: "FormatException: Unexpected end of input (at character 1)"

93 Views Asked by At

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?

2

There are 2 best solutions below

1
On
@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

0
On

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