首页 > 解决方案 > 我正在尝试运行命令“flutter packages pub run build_runner build”,但我得到一个错误作为返回,有人可以帮助我吗?

问题描述

我正在尝试运行命令“flutter packages pub run build_runner build”,但我得到一个错误作为返回,有人可以帮助我吗?

这是我的代码


import 'package:chopper/chopper.dart';

part 'post_api_service.chopper.dart';

@ChopperApi(baseUrl: 'https://jsonplaceholder.typicode.com/posts')
abstract class PostApiService extends ChopperService {
  @Get()
  Future<Response> getPosts();

  @Get(path: '/{id}')
  Future<Response> getPost(@Path('id') int id);

  @Post()
  Future<Response> postPost(
    @Body() Map<String, dynamic> body,
  );
}

这是回报

PS C:\srs\innovation\chopper\chopper_api> flutter packages pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 414ms

[WARNING] Invalidated precompiled build script due to missing asset graph.
[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 1.1s

[SEVERE]
type 'Null' is not a subtype of type 'String' in type cast
pub finished with exit code 78
PS C:\srs\innovation\chopper\chopper_api>

标签: flutter-run

解决方案


推荐阅读