Error: Getter not found: 'defaultType'. aqueduct , dart, vscode

Error: Getter not found: 'defaultType'. aqueduct , dart, vscode

我刚开始使用 Aqueduct 创建 API。

我在 运行 aqueduct 在 VS Code 终端服务时遇到了一些错误

    -- Aqueduct CLI Version: 3.2.1
    -- Aqueduct project version: 3.3.0-b1
    -- Preparing...
*** Uncaught error
IsolateSpawnException: Unable to spawn isolate: 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%3Aquiz_api%2Fquiz_api.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%7Bvar%20channelType%20%3D%20ApplicationChannel.defaultType%3B%20if%20(channelType%20%3D%3D%20null)%20%7Breturn%20null%3B%7D%20return%20MirrorSystem.getName(reflectClass(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%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:13:204: Error: Getter not found: 'defaultType'.
class GetChannelExecutable extends Executable<String> {GetChannelExecutable(Map<String, dynamic> message) : super(message); @override Future<String> execute() async {var channelType = ApplicationChannel.defaultType; if (channelType == null) {return null;} return MirrorSystem.getName(reflectClass(channelType).simpleName);} static List<String> importsForPackage(String packageName) => ["package:aqueduct/aqueduct.dart", "package:$packageName/$packageName.dart"];}

                                                                                              ^^^^^^^^^^^    
    **** Stacktrace
    ****

以下命令对我有用:

pub run aqueduct serve

应该更新渡槽教程(至少 Windows)。 这也适用于命令 "aqueduct db generate",它仅在我第一次遇到错误时用作 "pub run aqueduct db generate"。 (我运行服务器最初在Visual Studio代码内。)

对于任何像我一样卡住的人,我得到的错误是:

*** Uncaught error

在一些异常转储之后:

migration_source.dart': The system cannot find the file specified.