Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Another newb with null sound problems #934

Open
riekusr opened this issue Jan 15, 2021 · 4 comments
Open

Another newb with null sound problems #934

riekusr opened this issue Jan 15, 2021 · 4 comments

Comments

@riekusr
Copy link

riekusr commented Jan 15, 2021

I managed to install aqueduct a couple of weeks ago, had to do some work arounds but it was all working (aqueduct serve, aqueduct db generate).

Then I ran into a weird problem, and reinstalled flutter and dart sdk. Offcourse aqueduct stopped in its tracks. So i am trying to get my backend working again. I think I had a seperate dart running and currently dar is installed with flutter.

dart version:
Dart SDK version: 2.12.0-133.7.beta (beta) (Tue Jan 12 09:25:38 2021 +0100) on "windows_x64"

I tried cloning aqueduct repo locally and
pub global activate --source
and this is in my pubspec.yaml

dependency_overrides:
  aqueduct:
    path:  C:\src\s\aqueduct\aqueduct
  aqueduct_test:
    path:  C:\src\s\aqueduct\aqueduct_test\

then pub run aqueduct serve:


`PS D:\projects\spur\backend> pub run aqueduct serve
-- Aqueduct CLI Version: 4.0.0-b1
-- Aqueduct project version: 4.0.0-b1
-- Preparing...
data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Adart_server%2Fdart_server.dart'%3B%0Aimport%20'package%3Aruntime%2Fruntime.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'_sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20GetChannelExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20GetChannelExecutable%20extends%20Executable%3CString%3E%20%7BGetChannelExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20super(message)%3B%20%40override%20Future%3CString%3E%20execute()%20async%20%7Bfinal%20channels%20%3D%20RuntimeContext.current.runtimes.iterable.whereType%3CChannelRuntime%3E()%3B%20if%20(channels.length%20!%3D%201)%20%7Bthrow%20StateError(%22No%20ApplicationChannel%20subclass%20was%20found%20for%20this%20project.%20%22%20%22Make%20sure%20it%20is%20imported%20in%20your%20application%20library%20file.%22)%3B%7D%20var%20runtime%20%3D%20channels.first%3B%20if%20(runtime%20%3D%3D%20null)%20%7Breturn%20null%3B%7D%20return%20MirrorSystem.getName(reflectClass(runtime.channelType).simpleName)%3B%7D%20static%20List%3CString%3E%20importsForPackage(String%20packageName)%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3A%24packageName%2F%24packageName.dart%22%2C%20%22package%3Aruntime%2Fruntime.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line_%22%20%3A%20message%7D)%3B%7D%7D%0A:15:825: Warning: Operand of null-aware operation '??' has type 'Symbol' which excludes null.
 - 'Symbol' is from 'dart:core'.
abstract class Executable<T> {Executable(this.message) : _sendPort = message["_sendPort"]; Future<T> execute(); final Map<String, dynamic> message; final SendPort _sendPort; U instanceOf<U>(String typeName, {List positionalArguments: const [], Map<Symbol, dynamic> namedArguments, Symbol constructorName}) {ClassMirror typeMirror = currentMirrorSystem().isolate.rootLibrary.declarations[new Symbol(typeName)]; if (typeMirror == null) {typeMirror = currentMirrorSystem().libraries.values.where((lib) => lib.uri.scheme == "package" || lib.uri.scheme == "file").expand((lib) => lib.declarations.values).firstWhere((decl) => decl is ClassMirror && MirrorSystem.getName(decl.simpleName) == typeName, orElse: () => throw new ArgumentError("Unknown type '$typeName'. Did you forget to import it?"));} return typeMirror.newInstance(constructorName ?? const Symbol(""), positionalArguments, namedArguments).reflectee as U;} void send(dynamic message) {_sendPort.send(message);} void log(String message) {_sendPort.send({"_line_" : message});}}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ^
*** Uncaught error
    IsolateSpawnException: Unable to spawn isolate: Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:aqueduct
 - package:dart_server
 - package:runtime
 - package:logging
 - package:safe_config
 - package:crypto
 - package:password_hash
 - package:open_api
 - package:analyzer
 - package:meta
 - package:pubspec_parse
 - package:yaml
 - package:isolate_executor
 - package:postgres
 - package:path
 - package:watcher
 - package:collection
 - package:convert
 - package:codable
 - package:cli_util
 - package:pub_semver
 - package:_fe_analyzer_shared
 - package:json_annotation
 - package:checked_yaml
 - package:charcode
 - package:source_span
 - package:typed_data
 - package:buffer
 - package:pedantic
 - package:string_scanner
 - package:glob
 - package:args
 - package:async
 - package:term_glyph
 - package:package_config

For solutions, see https://dart.dev/go/unsound-null-safety
data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Adart_server%2Fdart_server.dart'%3B%0Aimport%20'package%3Aruntime%2Fruntime.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'_sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20GetChannelExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20GetChannelExecutable%20extends%20Executable%3CString%3E%20%7BGetChannelExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20super(message)%3B%20%40override%20Future%3CString%3E%20execute()%20async%20%7Bfinal%20channels%20%3D%20RuntimeContext.current.runtimes.iterable.whereType%3CChannelRuntime%3E()%3B%20if%20(channels.length%20!%3D%201)%20%7Bthrow%20StateError(%22No%20ApplicationChannel%20subclass%20was%20found%20for%20this%20project.%20%22%20%22Make%20sure%20it%20is%20imported%20in%20your%20application%20library%20file.%22)%3B%7D%20var%20runtime%20%3D%20channels.first%3B%20if%20(runtime%20%3D%3D%20null)%20%7Breturn%20null%3B%7D%20return%20MirrorSystem.getName(reflectClass(runtime.channelType).simpleName)%3B%7D%20static%20List%3CString%3E%20importsForPackage(String%20packageName)%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3A%24packageName%2F%24packageName.dart%22%2C%20%22package%3Aruntime%2Fruntime.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line_%22%20%3A%20message%7D)%3B%7D%7D%0A:15:266: Error: The parameter 'namedArguments' can't have a value of 'null' because of its type 'Map<Symbol, dynamic>', but the implicit default value is 'null'.
 - 'Map' is from 'dart:core'.
 - 'Symbol' is from 'dart:core'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
abstract class Executable<T> {Executable(this.message) : _sendPort = message["_sendPort"]; Future<T> execute(); final Map<String, dynamic> message; final SendPort _sendPort; U instanceOf<U>(String typeName, {List positionalArguments: const [], Map<Symbol, dynamic> namedArguments, Symbol constructorName}) {ClassMirror typeMirror = currentMirrorSystem().isolate.rootLibrary.declarations[new Symbol(typeName)]; if (typeMirror == null) {typeMirror = currentMirrorSystem().libraries.values.where((lib) => lib.uri.scheme == "package" || lib.uri.scheme == "file").expand((lib) => lib.declarations.values).firstWhere((decl) => decl is ClassMirror && MirrorSystem.getName(decl.simpleName) == typeName, orElse: () => throw new ArgumentError("Unknown type '$typeName'. Did you forget to import it?"));} return typeMirror.newInstance(constructorName ?? const Symbol(""), positionalArguments, namedArguments).reflectee as U;} void send(dynamic message) {_sendPort.send(message);} void log(String message) {_sendPort.send({"_line_" : message});}}
                                                                                                                                                                                                                                                                         ^^^^^^^^^^^^^^
data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Adart_server%2Fdart_server.dart'%3B%0Aimport%20'package%3Aruntime%2Fruntime.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'_sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20GetChannelExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20GetChannelExecutable%20extends%20Executable%3CString%3E%20%7BGetChannelExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20super(message)%3B%20%40override%20Future%3CString%3E%20execute()%20async%20%7Bfinal%20channels%20%3D%20RuntimeContext.current.runtimes.iterable.whereType%3CChannelRuntime%3E()%3B%20if%20(channels.length%20!%3D%201)%20%7Bthrow%20StateError(%22No%20ApplicationChannel%20subclass%20was%20found%20for%20this%20project.%20%22%20%22Make%20sure%20it%20is%20imported%20in%20your%20application%20library%20file.%22)%3B%7D%20var%20runtime%20%3D%20channels.first%3B%20if%20(runtime%20%3D%3D%20null)%20%7Breturn%20null%3B%7D%20return%20MirrorSystem.getName(reflectClass(runtime.channelType).simpleName)%3B%7D%20static%20List%3CString%3E%20importsForPackage(String%20packageName)%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3A%24packageName%2F%24packageName.dart%22%2C%20%22package%3Aruntime%2Fruntime.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line_%22%20%3A%20message%7D)%3B%7D%7D%0A:15:289: Error: The parameter 'constructorName' can't have a value of 'null' because of its type 'Symbol', but the implicit default value is 'null'.
 - 'Symbol' is from 'dart:core'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
abstract class Executable<T> {Executable(this.message) : _sendPort = message["_sendPort"]; Future<T> execute(); final Map<String, dynamic> message; final SendPort _sendPort; U instanceOf<U>(String typeName, {List positionalArguments: const [], Map<Symbol, dynamic> namedArguments, Symbol constructorName}) {ClassMirror typeMirror = currentMirrorSystem().isolate.rootLibrary.declarations[new Symbol(typeName)]; if (typeMirror == null) {typeMirror = currentMirrorSystem().libraries.values.where((lib) => lib.uri.scheme == "package" || lib.uri.scheme == "file").expand((lib) => lib.declarations.values).firstWhere((decl) => decl is ClassMirror && MirrorSystem.getName(decl.simpleName) == typeName, orElse: () => throw new ArgumentError("Unknown type '$typeName'. Did you forget to import it?"));} return typeMirror.newInstance(constructorName ?? const Symbol(""), positionalArguments, namedArguments).reflectee as U;} void send(dynamic message) {_sendPort.send(message);} void log(String message) {_sendPort.send({"_line_" : message});}}
                                                                                                                                                                                                                                                                                                ^^^^^^^^^^^^^^^
data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Adart_server%2Fdart_server.dart'%3B%0Aimport%20'package%3Aruntime%2Fruntime.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'_sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20GetChannelExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20GetChannelExecutable%20extends%20Executable%3CString%3E%20%7BGetChannelExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20super(message)%3B%20%40override%20Future%3CString%3E%20execute()%20async%20%7Bfinal%20channels%20%3D%20RuntimeContext.current.runtimes.iterable.whereType%3CChannelRuntime%3E()%3B%20if%20(channels.length%20!%3D%201)%20%7Bthrow%20StateError(%22No%20ApplicationChannel%20subclass%20was%20found%20for%20this%20project.%20%22%20%22Make%20sure%20it%20is%20imported%20in%20your%20application%20library%20file.%22)%3B%7D%20var%20runtime%20%3D%20channels.first%3B%20if%20(runtime%20%3D%3D%20null)%20%7Breturn%20null%3B%7D%20return%20MirrorSystem.getName(reflectClass(runtime.channelType).simpleName)%3B%7D%20static%20List%3CString%3E%20importsForPackage(String%20packageName)%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3A%24packageName%2F%24packageName.dart%22%2C%20%22package%3Aruntime%2Fruntime.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line_%22%20%3A%20message%7D)%3B%7D%7D%0A:14:483: Error: The value 'null' can't be returned from an async function with return type 'Future<String>' because 'Future<String>' is not nullable.
 - 'Future' is from 'dart:async'.
class GetChannelExecutable extends Executable<String> {GetChannelExecutable(Map<String, dynamic> message) : super(message); @override Future<String> execute() async {final channels = RuntimeContext.current.runtimes.iterable.whereType<ChannelRuntime>(); if (channels.length != 1) {throw StateError("No ApplicationChannel subclass was found for this project. " "Make sure it is imported in your application library file.");} var runtime = channels.first; if (runtime == null) {return null;} return MirrorSystem.getName(reflectClass(runtime.channelType).simpleName);} static List<String> importsForPackage(String packageName) => ["package:aqueduct/aqueduct.dart", "package:$packageName/$packageName.dart", "package:runtime/runtime.dart"];}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^
data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Adart_server%2Fdart_server.dart'%3B%0Aimport%20'package%3Aruntime%2Fruntime.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'_sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20GetChannelExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20GetChannelExecutable%20extends%20Executable%3CString%3E%20%7BGetChannelExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20super(message)%3B%20%40override%20Future%3CString%3E%20execute()%20async%20%7Bfinal%20channels%20%3D%20RuntimeContext.current.runtimes.iterable.whereType%3CChannelRuntime%3E()%3B%20if%20(channels.length%20!%3D%201)%20%7Bthrow%20StateError(%22No%20ApplicationChannel%20subclass%20was%20found%20for%20this%20project.%20%22%20%22Make%20sure%20it%20is%20imported%20in%20your%20application%20library%20file.%22)%3B%7D%20var%20runtime%20%3D%20channels.first%3B%20if%20(runtime%20%3D%3D%20null)%20%7Breturn%20null%3B%7D%20return%20MirrorSystem.getName(reflectClass(runtime.channelType).simpleName)%3B%7D%20static%20List%3CString%3E%20importsForPackage(String%20packageName)%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3A%24packageName%2F%24packageName.dart%22%2C%20%22package%3Aruntime%2Fruntime.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line_%22%20%3A%20message%7D)%3B%7D%7D%0A:15:387: Error: A value of type 'DeclarationMirror?' can't be assigned to a variable of type 'ClassMirror'.
 - 'DeclarationMirror' is from 'dart:mirrors'.
 - 'ClassMirror' is from 'dart:mirrors'.
abstract class Executable<T> {Executable(this.message) : _sendPort = message["_sendPort"]; Future<T> execute(); final Map<String, dynamic> message; final SendPort _sendPort; U instanceOf<U>(String typeName, {List positionalArguments: const [], Map<Symbol, dynamic> namedArguments, Symbol constructorName}) {ClassMirror typeMirror = currentMirrorSystem().isolate.rootLibrary.declarations[new Symbol(typeName)]; if (typeMirror == null) {typeMirror = currentMirrorSystem().libraries.values.where((lib) => lib.uri.scheme == "package" || lib.uri.scheme == "file").expand((lib) => lib.declarations.values).firstWhere((decl) => decl is ClassMirror && MirrorSystem.getName(decl.simpleName) == typeName, orElse: () => throw new ArgumentError("Unknown type '$typeName'. Did you forget to import it?"));} return typeMirror.newInstance(constructorName ?? const Symbol(""), positionalArguments, namedArguments).reflectee as U;} void send(dynamic message) {_sendPort.send(message);} void log(String message) {_sendPort.send({"_line_" : message});}}
                                                                                                                                                                                                                                                                                                                                                                                                  ^
data:application/dart;charset=utf-8,import%20'dart%3Aasync'%3B%0Aimport%20'dart%3Aisolate'%3B%0Aimport%20'dart%3Amirrors'%3B%0Aimport%20'package%3Aaqueduct%2Faqueduct.dart'%3B%0Aimport%20'package%3Adart_server%2Fdart_server.dart'%3B%0Aimport%20'package%3Aruntime%2Fruntime.dart'%3B%0AFuture%20main%20(List%3CString%3E%20args%2C%20Map%3CString%2C%20dynamic%3E%20message)%20async%20%7B%0A%20%20final%20sendPort%20%3D%20message%5B'_sendPort'%5D%3B%0A%20%20final%20executable%20%3D%20new%20GetChannelExecutable(message)%3B%0A%20%20final%20result%20%3D%20await%20executable.execute()%3B%0A%20%20sendPort.send(%7B%22_result%22%3A%20result%7D)%3B%0A%7D%0A%20%20%20%20%0Aclass%20GetChannelExecutable%20extends%20Executable%3CString%3E%20%7BGetChannelExecutable(Map%3CString%2C%20dynamic%3E%20message)%20%3A%20super(message)%3B%20%40override%20Future%3CString%3E%20execute()%20async%20%7Bfinal%20channels%20%3D%20RuntimeContext.current.runtimes.iterable.whereType%3CChannelRuntime%3E()%3B%20if%20(channels.length%20!%3D%201)%20%7Bthrow%20StateError(%22No%20ApplicationChannel%20subclass%20was%20found%20for%20this%20project.%20%22%20%22Make%20sure%20it%20is%20imported%20in%20your%20application%20library%20file.%22)%3B%7D%20var%20runtime%20%3D%20channels.first%3B%20if%20(runtime%20%3D%3D%20null)%20%7Breturn%20null%3B%7D%20return%20MirrorSystem.getName(reflectClass(runtime.channelType).simpleName)%3B%7D%20static%20List%3CString%3E%20importsForPackage(String%20packageName)%20%3D%3E%20%5B%22package%3Aaqueduct%2Faqueduct.dart%22%2C%20%22package%3A%24packageName%2F%24packageName.dart%22%2C%20%22package%3Aruntime%2Fruntime.dart%22%5D%3B%7D%0Aabstract%20class%20Executable%3CT%3E%20%7BExecutable(this.message)%20%3A%20_sendPort%20%3D%20message%5B%22_sendPort%22%5D%3B%20Future%3CT%3E%20execute()%3B%20final%20Map%3CString%2C%20dynamic%3E%20message%3B%20final%20SendPort%20_sendPort%3B%20U%20instanceOf%3CU%3E(String%20typeName%2C%20%7BList%20positionalArguments%3A%20const%20%5B%5D%2C%20Map%3CSymbol%2C%20dynamic%3E%20namedArguments%2C%20Symbol%20constructorName%7D)%20%7BClassMirror%20typeMirror%20%3D%20currentMirrorSystem().isolate.rootLibrary.declarations%5Bnew%20Symbol(typeName)%5D%3B%20if%20(typeMirror%20%3D%3D%20null)%20%7BtypeMirror%20%3D%20currentMirrorSystem().libraries.values.where((lib)%20%3D%3E%20lib.uri.scheme%20%3D%3D%20%22package%22%20%7C%7C%20lib.uri.scheme%20%3D%3D%20%22file%22).expand((lib)%20%3D%3E%20lib.declarations.values).firstWhere((decl)%20%3D%3E%20decl%20is%20ClassMirror%20%26%26%20MirrorSystem.getName(decl.simpleName)%20%3D%3D%20typeName%2C%20orElse%3A%20()%20%3D%3E%20throw%20new%20ArgumentError(%22Unknown%20type%20'%24typeName'.%20Did%20you%20forget%20to%20import%20it%3F%22))%3B%7D%20return%20typeMirror.newInstance(constructorName%20%3F%3F%20const%20Symbol(%22%22)%2C%20positionalArguments%2C%20namedArguments).reflectee%20as%20U%3B%7D%20void%20send(dynamic%20message)%20%7B_sendPort.send(message)%3B%7D%20void%20log(String%20message)%20%7B_sendPort.send(%7B%22_line_%22%20%3A%20message%7D)%3B%7D%7D%0A:15:601: Error: A value of type 'DeclarationMirror' can't be assigned to a variable of type 'ClassMirror'.
 - 'DeclarationMirror' is from 'dart:mirrors'.
 - 'ClassMirror' is from 'dart:mirrors'.
abstract class Executable<T> {Executable(this.message) : _sendPort = message["_sendPort"]; Future<T> execute(); final Map<String, dynamic> message; final SendPort _sendPort; U instanceOf<U>(String typeName, {List positionalArguments: const [], Map<Symbol, dynamic> namedArguments, Symbol constructorName}) {ClassMirror typeMirror = currentMirrorSystem().isolate.rootLibrary.declarations[new Symbol(typeName)]; if (typeMirror == null) {typeMirror = currentMirrorSystem().libraries.values.where((lib) => lib.uri.scheme == "package" || lib.uri.scheme == "file").expand((lib) => lib.declarations.values).firstWhere((decl) => decl is ClassMirror && MirrorSystem.getName(decl.simpleName) == typeName, orElse: () => throw new ArgumentError("Unknown type '$typeName'. Did you forget to import it?"));} return typeMirror.newInstance(constructorName ?? const Symbol(""), positionalArguments, namedArguments).reflectee as U;} void send(dynamic message) {_sendPort.send(message);} void log(String message) {_sendPort.send({"_line_" : message});}}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ^
  **** Stacktrace
  ****
PS D:\projects\spur\backend>`

I assume it has to do with the dart SDK being on the latest and running in sound null safety,

So I downloaded dart2.8.4 SDK and updated the path variable. but dart --version still shows 2.12.

C:\Users\RR>where dart
C:\src\flutter\bin\dart
C:\src\flutter\bin\dart.bat
C:\src\dart\sdk-2.8.4\sdk\bin\dart
C:\src\dart\sdk-2.8.4\sdk\bin\dart.bat

Can someone describe (for a newbie) how I can work around this? Preferably using latest dart for my flutter project and then downgrade it for aqueduct project?

@riekusr
Copy link
Author

riekusr commented Jan 16, 2021

I have got this running now,
I had to place the enviroment variable of the SDK above the flutter one

@kabagouda
Copy link

You should know that you added the SDK wrong. You know, do it manually. Go to the folder where the dart SDK (2.12) is located and delete it . And now put version 2.8 instead .

@kabagouda
Copy link

I have got this running now,
I had to place the enviroment variable of the SDK above the flutter one

Nice

@riekusr
Copy link
Author

riekusr commented Jan 16, 2021

You should know that you added the SDK wrong. You know, do it manually. Go to the folder where the dart SDK (2.12) is located and delete it . And now put version 2.8 instead .

But it is running insde the flutter folder, and flutter needs the recent SDK.

I got aqueduct up and running and can continue with my project. My question is, can anyone tell me if I can also get this running with the latest SDK? The above errors apply when I try that setup.

edit: Running in the same problem why I initially had to reinstall everyting: https://stackoverflow.com/questions/65755371/localappdata-folder-corrupting-my-dart-and-flutter-projects

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

No branches or pull requests

2 participants