Comments (12)
@pkozlovskiy that looks like you are trying to import Flutter code into a Brick model. Is that the case?
If it is, the problem is that Flutter ships with a version of Dart that is incompatible with build_runner.
Instead, consider using extensions to your Brick models within your Flutter code to avoid importing packages/code that are dependent on Flutter to .model.dart files.
from brick.
I copy 'brick' folder in clean project and 'build_runner build" run without error.
I had to remove the use in the project
'part' and 'part of'
as a solution.
from brick.
@pkozlovskiy is this issue resolved? Or are you still having problems?
from brick.
Same problem here.
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/features/auth/cubit/auth_login_state.dart: Asset [bable2_tracking_app|lib/features/auth/cubit/auth_login_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
Looks like brick_offline_first_with_rest_build:brickAdaptersBuilder
is considering every file with 'part of' on it. However, when using, for example, flutter_bloc
, it is usual to have 'part of' for state and event files
Is there a way to ignore specific folders like bloc
and cubit
around the project? Or another solution?
from brick.
@edgarbs1998 are you importing auth_login_state
into the Brick model? Can you share your model file?
from brick.
My current model file is as follows (there is no import of any state
file):
import 'package:bable2_tracking_app/features/diary/enums/diary_entry_category.dart';
import 'package:bable2_tracking_app/features/diary/enums/diary_entry_type.dart';
import 'package:brick_offline_first_with_rest/offline_first_with_rest.dart';
@ConnectOfflineFirstWithRest()
class DiaryEntry extends OfflineFirstWithRestModel {
DiaryEntry({
this.id,
required this.category,
required this.type,
required this.createdAt,
});
@Sqlite(unique: true)
final String? id;
@Rest(enumAsString: true)
@Sqlite(enumAsString: true)
final DiaryEntryCategory category;
final DiaryEntryType type;
final DateTime createdAt;
}
However, the builder is picking up all my state
files from flutter_bloc
.
I will let the full Log of the build runner task. Note I have to run two times the build runner in order to my schema.g.dart
have the part '20230103165504.migration.dart';
line for the imports to work.
Buld runner log:
flutter pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 479ms
[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 10.3s
FlutterGen v5.0.0 Loading ... pubspec.yaml
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 2.5s [INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Running build...
[INFO] Generating SDK summary...
[INFO] 4.5s elapsed, 0/16 actions completed.
[INFO] Generating SDK summary completed, took 4.3s
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/boot/cubit/boot_state.dart: Asset [bable2_tracking_app|lib/boot/cubit/boot_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/features/home/cubit/home_state.dart: Asset [bable2_tracking_app|lib/features/home/cubit/home_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[WARNING] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/main_development.dart: Your current `analyzer` version may not fully support your current SDK version. Analyzer language version: 2.17.0 SDK language version: 2.18.0 Please update to the latest `analyzer` version (5.3.1) by running `flutter packages upgrade`. If you are not getting the latest version by running the above command, you can try adding a constraint like the following to your pubspec to start diagnosing why you can't get the latest version: dev_dependencies: analyzer: ^5.3.1
[INFO] 6.5s elapsed, 2/18 actions completed.
[INFO] 7.6s elapsed, 3/18 actions completed.
[INFO] 8.9s elapsed, 3/18 actions completed.
[INFO] 9.9s elapsed, 3/19 actions completed.
[INFO] 10.9s elapsed, 3/19 actions completed.
[INFO] 12.0s elapsed, 3/19 actions completed.
[INFO] 13.1s elapsed, 3/19 actions completed.
[INFO] 22.8s elapsed, 3/19 actions completed.
[WARNING] No actions completed for 15.5s, waiting on: - brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/main_development.dart - brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/l10n/l10n.dart - brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/bootstrap.dart - brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/app/view/app.dart - brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/app/app.dart .. and 11 more
[INFO] 28.2s elapsed, 4/19 actions completed.
[INFO] 30.0s elapsed, 8/23 actions completed.
[INFO] 32.7s elapsed, 8/24 actions completed.
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/features/sign_up_survivor/cubit/sign_up_form_state.dart: Asset [bable2_tracking_app|lib/features/sign_up_survivor/cubit/sign_up_form_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/features/sign_up_survivor/cubit/sign_up_validation_state.dart: Asset [bable2_tracking_app|lib/features/sign_up_survivor/cubit/sign_up_validation_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/features/auth/cubit/auth_login_state.dart: Asset [bable2_tracking_app|lib/features/auth/cubit/auth_login_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/features/diary/diary_create_edit/cubit/diary_create_edit_state.dart: Asset [bable2_tracking_app|lib/features/diary/diary_create_edit/cubit/diary_create_edit_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/features/diary/diary_list/cubit/diary_list_state.dart: Asset [bable2_tracking_app|lib/features/diary/diary_list/cubit/diary_list_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/features/diary/diary_details/cubit/diary_details_state.dart: Asset [bable2_tracking_app|lib/features/diary/diary_details/cubit/diary_details_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[INFO] Generated diary_entry_adapter.g.dart (DiaryEntry), took 408ms
[INFO] 37.0s elapsed, 83/85 actions completed.
[INFO] Aggregating models and migrations...
[INFO] Generated brick.g.dart, took 142ms
[INFO] Generated new migration (db/20230103165504.migration.dart), took 2ms
[INFO] Generated db/schema.g.dart, took 39ms
Generated: lib/gen/assets.gen.dart FlutterGen finished.
[INFO] 39.3s elapsed, 155/155 actions completed.
[INFO] Running build completed, took 40.2s [INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 340ms
[SEVERE] Failed after 40.6s
from brick.
@edgarbs1998 what is the contents of DiaryEntryType
?
[WARNING] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/main_development.dart: Your current
analyzer
version may not fully support your current SDK version. Analyzer language version: 2.17.0 SDK language version: 2.18.0 Please update to the latestanalyzer
version (5.3.1) by runningflutter packages upgrade
. If you are not getting the latest version by running the above command, you can try adding a constraint like the following to your pubspec to start diagnosing why you can't get the latest version: dev_dependencies: analyzer: ^5.3.1
This line is also a concern. Can you upgrade to analyzer 5.3.1
, and if that doesn't work, 4.7.0
?
from brick.
I had some trouble updating the analyzer
due to flutter_test
from the SDK being outdated I think. I am using last Flutter version, 3.3.10 with Dart 2.18.6.
I am new to Flutter, so not fully aware of of Flutter package version solving. Is tthere anything I can change in order to force the use go analyzer: ^5.3.1
?
analyzer 5.3.1
gives me the following conflicts:
Running "flutter pub get" in brick_test...
Because every version of flutter_test from sdk depends on collection 1.16.0 and analyzer >=5.3.1 depends on collection ^1.17.0, flutter_test from sdk is incompatible with analyzer >=5.3.1.
So, because brick_test depends on both analyzer ^5.3.1 and flutter_test from sdk, version solving failed.
pub get failed (1; So, because brick_test depends on both analyzer ^5.3.1 and flutter_test from sdk, version solving failed.)
analyzer 4.7.0
gives me the following conflicts:
Running "flutter pub get" in brick_test...
Because brick_offline_first_with_rest_build <1.0.0 depends on logging ^0.11.3 and brick_offline_first_with_rest_build >=1.3.0 depends on analyzer ^3.2.0, brick_offline_first_with_rest_build <1.0.0-∞ or >=1.3.0 requires logging ^0.11.3 or analyzer ^3.2.0.
And because brick_offline_first_with_rest_build ^1.0.0 depends on brick_offline_first_abstract ^1.0.0+1, every version of brick_offline_first_with_rest_build requires brick_offline_first_abstract ^1.0.0+1 or logging ^0.11.3 or analyzer ^3.2.0.
And because brick_offline_first_with_rest 1.1.0 depends on both brick_offline_first_abstract ^2.0.0 and logging ^1.0.0, if brick_offline_first_with_rest_build any and brick_offline_first_with_rest 1.1.0 then analyzer ^3.2.0.
And because no versions of brick_offline_first_with_rest match >1.1.0 <2.0.0 and brick_test depends on brick_offline_first_with_rest ^1.1.0, every version of brick_offline_first_with_rest_build requires analyzer ^3.2.0.
So, because brick_test depends on both analyzer ^4.7.0 and brick_offline_first_with_rest_build any, version solving failed.
pub get failed (1; So, because brick_test depends on both analyzer ^4.7.0 and brick_offline_first_with_rest_build any, version solving failed.)
Also I will let my pubspec file:
name: brick_test
description: A Very Good Project created by Very Good CLI.
version: 1.0.0+1
publish_to: none
environment:
sdk: ">=2.18.0 <3.0.0"
flutter: 3.3.8
dependencies:
bloc: ^8.1.0
brick_offline_first_with_rest: ^1.1.0
brick_sqlite: any
flutter:
sdk: flutter
flutter_bloc: ^8.1.1
flutter_localizations:
sdk: flutter
intl: ^0.17.0
sqflite: any
dev_dependencies:
analyzer: ^4.7.0
bloc_test: ^9.1.0
brick_offline_first_with_rest_build: any
build_runner: any
flutter_test:
sdk: flutter
mocktail: ^0.3.0
very_good_analysis: ^3.1.0
flutter:
uses-material-design: true
generate: true
Also, I will let my project folder structure, not sure if it may affect anything on Brick 2.
| [lib]
| - [brick]
| | - [adapters]
| | - [db]
| | - data_repository.dart
| - [features]
| | - [diary]
| | | - [diary_list]
| | | | - [cubit]
| | | | | - diary_list_cubit.dart
| | | | | - diary_list_state.dart
| | | - [models]
| | | | - diary_entry.model.dart
from brick.
Providing a full example repository of this issue.
Repository: https://github.com/edgarbs1998/brick_issue_309/blob/main/README.md
Log of the build_runer
run:
flutter pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 198ms
[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 3.4s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 407ms [INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 0ms
[INFO] Running build...
[INFO] Generating SDK summary...
[INFO] 1.8s elapsed, 0/14 actions completed.
[INFO] Generating SDK summary completed, took 1.8s
[SEVERE] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/notes/cubit/notes_state.dart: Asset [brick_issue_309|lib/notes/cubit/notes_state.dart] is not a Dart library. It may be a part file or a file without Dart source code.
[WARNING] brick_offline_first_with_rest_build:brickAdaptersBuilder on lib/main_development.dart: Your current `analyzer` version may not fully support your current SDK version. Analyzer language version: 2.17.0 SDK language version: 2.18.0 Please update to the latest `analyzer` version (5.3.1) by running `flutter packages upgrade`. If you are not getting the latest version by running the above command, you can try adding a constraint like the following to your pubspec to start diagnosing why you can't get the latest version: dev_dependencies: analyzer: ^5.3.1
[INFO] 3.1s elapsed, 1/14 actions completed.
[INFO] 4.2s elapsed, 1/14 actions completed.
[INFO] 6.3s elapsed, 1/14 actions completed.
[INFO] 8.1s elapsed, 3/14 actions completed.
[INFO] Generated note_adapter.g.dart (Note), took 44ms
[INFO] Aggregating models and migrations...
[INFO] Generated brick.g.dart, took 2ms
[INFO] Generated db/schema.g.dart, took 7ms
[INFO] Running build completed, took 8.3s [INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 31ms
[SEVERE] Failed after 8.4s
from brick.
@edgarbs1998 This is helpful, thank you. Let me poke around. The logging dependency is likely what's causing this.
from brick.
@edgarbs1998 I mistakenly did not publish brick_offline_first_with_rest_build
v2.1.0. I apologize for this.
I've used your pubspec and am able to bundle analyzer 4.7.0 . Please try using build_runner
again cc @pkozlovskiy
from brick.
@tshedor The build_runner
is now working with no errors or warnings. I think the analyzer
conflict was also caused by the incorrect version of brick_offline_first_with_rest_build
. Thank you for your work, it is an amazing library.
from brick.
Related Issues (20)
- Function afterSave() is generated wrong HOT 7
- databaseFactoryFfi not save data in local HOT 1
- Outdated package dependencies HOT 1
- Support to windows not work HOT 3
- Adapter file not generated when uniquely identified field is a class and no primitive HOT 14
- multipart request HOT 8
- Feature: Support for more database adapters HOT 2
- Relative imports in models are not correctly transferred to brick.g.dart HOT 2
- Question (Perhaps Not an Issue) About topLevelKey HOT 2
- Dependencies Issue HOT 2
- Getting POST When I Need PUT HOT 5
- Handling Expired Access Keys in Offline Request Queue HOT 2
- Question: How to correctly upsert an association to a REST Provider? HOT 6
- Proposal: add the response details to the offline request queue HOT 4
- Documents that do not exist remotely are not deleted from local memory HOT 1
- Remove Items From Outbound Queue HOT 4
- Problem Re-initializing HOT 8
- Duplicate Column in Migration Script HOT 6
- Read from REST but Don't Write Back to REST HOT 3
- Unexpected Remote Provider Calls for Associated Data HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brick.