Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create build script snapshot #519

Closed
roma7481 opened this issue Mar 19, 2021 · 2 comments · Fixed by #520
Closed

Can't create build script snapshot #519

roma7481 opened this issue Mar 19, 2021 · 2 comments · Fixed by #520

Comments

@roma7481
Copy link

roma7481 commented Mar 19, 2021

I am trying to implement floor database in my project. I did all the steps and still has errors while trying to run
flutter packages pub run build_runner build

My console:
[INFO] Creating build script snapshot......
[WARNING] stderr: /C:/Users/xxxx/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/floor_generator-1.0.0/lib/misc/type_utils.dart:49:31: Error: A value of type 'DartObject?' can't be returned from a function with return type
'DartObject' because 'DartObject?' is nullable and 'DartObject' isn't.
[WARNING] stderr: - 'DartObject' is from 'package:analyzer/dart/constant/value.dart' ('/C:/Users/Roman-Alisa/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.2.0/lib/dart/constant/value.dart').
[WARNING] stderr: return _typeChecker(type).firstAnnotationOfExact(this);
[WARNING] stderr: ^
[INFO] Creating build script snapshot... completed, took 12.7s

[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.

my dart classes

@dao
abstract class NoteDao {

@query('SELECT * FROM '+ noteTableName)
Future<List> getList();

@insert
Future insertNote(NoteModel note);

@update
Future updateNote(NoteModel note);

@delete
Future deleteNote(NoteModel note);

@delete
Future deleteNotes(List notes);
}

@database(version: 1, entities: [NoteModel])
abstract class AppDatabase extends FloorDatabase {
NoteDao getnoteDao;

}

my yaml file

version: 1.0.0+1

environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
just_audio: ^0.7.0
audio_service: ^0.17.0-nullsafety.0
http: ^0.13.0
floor: ^1.0.0
firebase_core: ^1.0.1
firebase_auth: ^1.0.1
flutter_bloc: ^7.0.0-nullsafety.5
cloud_firestore: ^1.0.1
provider: ^5.0.0
cached_network_image: ^3.0.0-nullsafety
nuts_activity_indicator: ^0.1.1

cupertino_icons: ^1.0.2

dev_dependencies:
flutter_test:
sdk: flutter
floor_generator: ^1.0.0
build_runner: ^1.12.2
/build:
dart:
dependency_overrides:
sqflite: ^2.0.0+3
rxdart: ^0.26.0
audio_session: ^0.1.0
floor_generator: ^1.0.0
uuid: ^3.0.1
build: ^2.0.0
source_gen: ^1.0.0

when I add @query('SELECT * FROM '+ noteTableName)
Future<List> getList();

it all falls apart. Could someone please help?

Thanks.

@proninyaroslav
Copy link

Same here. analyzer: ^1.2.0, build: ^2.0.0, source_gen: ^1.0.0.

@proninyaroslav
Copy link

proninyaroslav commented Mar 20, 2021

There seems to be a problem in source_gen, version 1.0.0 uses null safety, but the floor_generator code is not adapted for this #504. As a quick workaround, we need to use a version of source_gen below 1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants