Built value generator fails - dart

Since this morning, the generation step of built value (pub run build_runner build) is failing with
[SEVERE] built_value_generator:built_value on lib/client.dart (cached):
Unknown error in BuiltValueGenerator for myproject|lib/client.dart.
NoSuchMethodError: The method 'getParsedLibraryByElement' was called on null.
Receiver: null
Tried calling: getParsedLibraryByElement(Instance of 'LibraryElementImpl')
I tried upgrading to built value 6.6.0 (from 6.3.2), but it didn't help
Dart version is 2.1.0-dev.9.4
Any suggestions are welcome

Related

Flutter #dart=2.9 import 'dart:math'; Error, dart code won't run in emulator?

Question: How can I solve the flutter error as shown below & why does this happen?
What I can't understand out of this error, is
that I can't comprehend what #dart=2.9 is. I hadn't previously run or coded the file in a while. So, when I came back to work on this flutter file project, it threw me this error?
I tried updating flutter on the command prompt. Everything it's fine according to the flutter doctor. The only missing piece is just visual studio, but I use visual studio Code. So, I am assuming that's not the problem. If not, then what could it be? I am deeply thinking about this long error, that can't get to comprehend.
Much appreciation in advance any sort of help will be gratefully appreciated
Error: Flutter run -
When I run flutter run it always displays the errors below.
Invalid depfile: C:\Users\14706\Desktop\Test-SETUP\New folder\This_Folder_Contains_Map_Tests_From_Top_To_Bottom_Atempts\Challenge_1\flutter_login_auth\.dart_tool\flutter_build\6494cc4bb6a11f1a583790c79662ece5\kernel_snapshot.d
Invalid depfile: C:\Users\14706\Desktop\Test-SETUP\New folder\This_Folder_Contains_Map_Tests_From_Top_To_Bottom_Atempts\Challenge_1\flutter_login_auth\.dart_tool\flutter_build\6494cc4bb6a11f1a583790c79662ece5\kernel_snapshot.d
../../../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_database-6.1.2/lib/firebase_database.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// #dart=2.9
^^^^^^^^^^^^
lib/Pages/auth/mainLoginCheck.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html';
^
../../../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_database-6.1.2/lib/src/utils/push_id_generator.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// #dart=2.9
^^^^^^^^^^^^
../../../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_database-6.1.2/lib/src/database_reference.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// #dart=2.9
^^^^^^^^^^^^
../../../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_database-6.1.2/lib/src/event.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// #dart=2.9
^^^^^^^^^^^^
../../../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_database-6.1.2/lib/src/firebase_database.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// #dart=2.9
^^^^^^^^^^^^
../../../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_database-6.1.2/lib/src/query.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// #dart=2.9
^^^^^^^^^^^^
../../../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_database-6.1.2/lib/src/on_disconnect.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// #dart=2.9
^^^^^^^^^^^^
Unhandled exception, umm...???
what even is this error that comes along down here?
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart
%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1 asFileUri (package:vm/kernel_front_end.dart:659:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:799:2
1)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:625:9)
<asynchronous suspension>
#4 starter
(package:frontend_server/frontend_server.dart:1451:12)
<asynchronous suspension>
#5 main (file:///C:/b/s/w/ir/x/w/sdk/pkg/frontend_server
/bin/
frontend_server_starter.dart:10:14)
<asynchronous suspension>
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\14706\Desktop\CODES\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\14706\Desktop\CODES\Flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 28s
Running Gradle task 'assembleDebug'... 30.1s
Exception: Gradle task assembleDebug failed with exit code 1
Error: Not found: 'dart:html'
import 'dart:html';
I have previoulsy tried updating flutter on command prompt. Everything it's fine according to flutter doctor. I have tried looking on what #=dart=2.9 is? but not enought understanding still. I have also tried looking on something the error highlights which is 'dart:html'; still, I don't comprehend how and why that is an errors?
1-just delete import 'dart:html'; from your code
2-run flutter clean then flutter pub get
if that doesn't work check this

"#required" annotation as error instead of warning

Right now in my Flutter project when I annotate a constructor parameter with #required and forget it when instantiating the constructor, I get a light warning from my IDE that the parameter is required.
I would like this to show up as an actual error from the IDE. Is there a way in analysis_options.yaml or somewhere else to set it as error instead of warning?
In analysis_options.yaml add
analyzer:
errors:
missing_required_param: error
before
$ flutter analyze
Analyzing flutter_0_generic...
info • The parameter 'onPressed' is required • lib/main.dart:49:33 • missing_required_param
1 issue found. (ran in 2.2s)
after
$ flutter analyze
Analyzing flutter_0_generic...
error • The parameter 'onPressed' is required • lib/main.dart:49:33 • missing_required_param
1 issue found. (ran in 1.8s)
See also https://www.dartlang.org/guides/language/analysis-options#changing-the-severity-of-analysis-rules

Dart - error running rpc generate client

I am trying to follow the "Beware the Nest o’ Pirates" tutorial
https://www.dartlang.org/codelabs/server/ and have hit a problem when I try to generate the client code for the PiratesApi
When I run the command
pub global run rpc:generate client -i lib/server/piratesapi.dart -o
lib/client
I get the following error message
Failed executing command 'discoveryWithImports' with error:
No constructor 'ApiParser' with matching arguments declared in class
'ApiParser'.
NoSuchMethodError: incorrect number of arguments passed to method
named 'ApiParser'
Receiver: Type: class 'ApiParser'
Tried calling: ApiParser(strict: true)
Found: ApiParser()
What does that error message mean?
Try activating the rpc package with a version constraint:
pub global activate rpc 0.4.1
https://www.dartlang.org/tools/pub/cmd/pub-global.html

Executing a dart application prints errors to console

I am using Dart Editor|
Dart Editor version 1.10.0.dev_01_01 (DEV)
Dart SDK version 1.10.0-dev.1.1
I open polymer_snippet and run the app and it executes as expected.
I attempted to run epimss_app but it does not run and displays the following errors to Tools Ouput (console)
--- 1:20:06 PM Starting pub serve : polymer_snippet ---
Loading source assets...
The null object does not have a getter 'pubspec'.
NoSuchMethodError: method not found: 'pubspec'
Receiver: null
Arguments: []
dart:core Object.noSuchMethod
e:\b\build\slave\dart-editor-win-dev\build\dart\sdk\lib\_internal\pub\lib\src\barback\dependency_computer.dart 48 DependencyComputer.DependencyComputer.<fn>
dart:collection SetMixin.every
e:\b\build\slave\dart-editor-win-dev\build\dart\sdk\lib\_internal\pub\lib\src\barback\dependency_computer.dart 47 DependencyComputer.DependencyComputer
e:\b\build\slave\dart-editor-win-dev\build\dart\sdk\lib\_internal\pub\lib\src\barback\load_all_transformers.dart 33 loadAllTransformers.<async>
dart:isolate _RawReceivePortImpl._handleMessage
This is an unexpected error. Please run
pub --trace 'serve' 'web' '--port' '8080' '--admin-port' '49923' '--hostname' 'localhost'
and include the results in a bug report on http://dartbug.com/new.
I tried to run polymer-snippet again with the same result. I closed Dart Editor did a pub cache repair and attempted running either application again with the same result.
The GUI (if dart-eclipse-editor is used) says Error Launching application - Could not start pub serve or connect to pub.
Why is this happening? I would expect to be able to change from one dart app to another and run either without any issues.
Thanks

After running CDE I can't build sample polymer app in dart editor

file:/C:/Users/Dave/dart/td2/build.dart
build.dart returned error code 255
Unhandled exception:
Uncaught Error: FileSystemException: Cannot open file, path = 'C:\Users\Dave\dart\td2\packages\args\args.dart' (OS Error: The system cannot find the file specified., errno = 2)
Stack Trace:
#0 _File.open.<anonymous closure> (dart:io/file_impl.dart:349)
#1 _RootZone.runUnary (dart:async/zone.dart:1151)
Dart editor was working fine with a polymer app that I was developing previously.
I have rebooted, reinstalled dart editor with no luck
Running Pub Get manually fails as well as it can't find files either. Evrrything was working prior to trying CDE and the designer.
I think running pub cache repair (run in command line interface) should be able to fix this.

Resources