输入'列表 '不是'List类型的子类型 “

问题描述 投票:1回答:1

我正在使用aqueduct,我收到错误

'List<Serializable>' is not a subtype of type 'List<MyManagedObject>' of 'list' #0 _TypeError._throwNew (dart:core/runtime/liberrors_patch.dart:89:51)

但我不知道是什么?我运行我的代码确定,只是我收到这个我无法解决的错误,我谷歌很多,但我找不到解决方案。这是我的'入口点'

@override
Controller get entryPoint {
  final router = Router();
  router
        .route('${apiBaseUrl}/objects')
        .link(() => ObjectController(context));
}

这是我的帖子方法:

@Operation.post()
Future<Response> createMyObject(@Bind.body() List<MyManagedObject> list) async {
  ...
  return Response.ok("ok");
}

我认为这可能是lib的错误,但我只是无法知道。

dart aqueduct
1个回答
2
投票

Dart 2.1.1发生了重大变化,导致绑定列表出现问题。它已在Aqueduct 3.2(今天发布3/7)中修复。

© www.soinside.com 2019 - 2024. All rights reserved.