Closed tenon-du closed 3 years ago
The error above is
[SEVERE] objectbox_generator:resolver on package:objectbox_generator/objectbox_generator.dart:
Bad state: Unexpected diagnostics:
/Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:152:17 - This requires the 'non-nullable' language feature to be enabled.
How is this related to ObjectBox for Flutter?
@DuJerry Do you get the same output with ObjectBox 0.8.0?
Also unable to generate objectbox after upgrading to flutter 1.22.1 and got the same error for
flutter packages pub run build_runner build --delete-conflicting-outputs
@softkot Did you also try with the recently released ObjectBox Dart 0.8.0
?
@softkot Did you also try with the recently released ObjectBox Dart
0.8.0
?
Yes i did it with 0.8.0
I found it works if use build_runner: 1.10.2
@softkot So what build_runner
version, that did not work, were you using?
1.10.1 does not work
1.10.1 does not work
That makes sense. According to their changelog this version pins analyzer to 0.39.14
.
https://pub.dev/packages/build_runner/changelog
build_runner
1.10.2
or higher?~ Edit: maybe not, requires Dart 2.10+.Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.7 19H2, locale zh-Hans-CN) • Flutter version 1.22.2 at /Users/dugang/Library/Android/flutter • Framework revision 84f3d28555 (5 days ago), 2020-10-15 16:26:19 -0700 • Engine revision b8752bbfff • Dart version 2.10.2 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn
dependencies:
json_annotation: ^3.1.0
objectbox: ^0.8.0
objectbox_flutter_libs: ^0.8.0
dev_dependencies:
build_runner: ^1.10.3
json_serializable: ^3.5.0
objectbox_generator: ^0.8.0
flutter packages pub run build_runner build
generate success
[INFO] Generating build script... [INFO] Generating build script completed, took 567ms
[INFO] Initializing inputs [INFO] Reading cached asset graph... [INFO] Reading cached asset graph completed, took 168ms
[INFO] Checking for updates since last build... [INFO] Checking for updates since last build completed, took 1.5s
[INFO] Running build... [INFO] 2.2s elapsed, 0/1 actions completed. [INFO] objectbox_generator:resolver on lib/model/entity/test.dart:entity Test(0:0) [INFO] objectbox_generator:resolver on lib/model/entity/test.dart: property id(0:0) type:6 flags:1 [INFO] objectbox_generator:generator on lib/$lib$:Package: ess [INFO] objectbox_generator:generator on lib/$lib$:Found 1 entities in: (lib/model/entity/test.objectbox.info) [INFO] objectbox_generator:generator on lib/$lib$:Using model: lib/objectbox-model.json [INFO] objectbox_generator:generator on lib/$lib$:Generating code: lib/objectbox.g.dart [INFO] Running build completed, took 2.4s
[INFO] Caching finalized dependency graph... [INFO] Caching finalized dependency graph completed, took 90ms
[INFO] Succeeded after 2.5s with 4 outputs (5 actions)
@DuJerry please try running pub upgrade
and see if that helps you get the fixed dependencies.
For context, this has been caused by https://github.com/dart-lang/build/issues/2763 and as has been said above, seems only to be resolvable by also requiring a fairly recent minimum dart SDK version (v2.10) enforced by the fixed build_runner
v1.10.2
@DuJerry Thanks for verifying using build_runner
^1.10.3
works as well!
So TL;DR for anyone coming here: use at least build_runner
1.10.2
, even better 1.10.3
.
1.10.2
It works! Thanks
Not sure if we can do anything on our side without raising min-SDK constraint so I'm closing the issue.
Feel free to follow up if you have any change suggestions.
my environment
the following error occurred when i use
flutter packages pub run build_runner build --delete-conflicting-outputs
.[INFO] Generating build script... [INFO] Generating build script completed, took 484ms
[WARNING] Deleted previous snapshot due to missing asset graph. [INFO] Creating build script snapshot...... [INFO] Creating build script snapshot... completed, took 17.0s
[INFO] Initializing inputs [INFO] Building new asset graph... [INFO] Building new asset graph completed, took 1.6s
[INFO] Checking for unexpected pre-existing outputs.... [INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Running build... [WARNING] objectbox_generator:resolver on package:objectbox_generator/objectbox_generator.dart: Your current
analyzer
version may not fully support your current SDK version.Please try upgrading to the latest
analyzer
by runningflutter packages upgrade
.Analyzer language version: 2.9.0 SDK language version: 2.10.0
If you are getting this message and have the latest analyzer please file an issue at https://github.com/dart-lang/sdk/issues/new with the title "No published analyzer available for language version 2.10.0". Please search the issue tracker first and thumbs up and/or subscribe to existing issues if present to avoid duplicates.
[INFO] Generating SDK summary... [SEVERE] objectbox_generator:resolver on package:objectbox_generator/objectbox_generator.dart:
Bad state: Unexpected diagnostics: /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:152:17 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:119:41 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:133:32 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:186:51 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:88:62 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:153:38 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:64:4 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:154:25 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:18:17 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:118:48 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:132:37 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:19:11 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:159:38 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:168:32 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:47:14 - This requires the 'non-nullable' language feature to be enabled. [SEVERE] objectbox_generator:resolver on package:objectbox_generator/objectbox_generator.dart:
Bad state: Unexpected diagnostics: /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:152:17 - This requires the 'non-nullable' language feature to be enabled. /Users/dugang/Library/Android/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:119: