I'm trying to run the command 'flutter packages pub run build_runner build' and I'm getting an error as return, can someone help me ??

This is my code


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,
  );
}

This is the return

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>
1

There are 1 answers

0
Fakhriddin Abdullaev On

Just run the below command:

flutter packages pub run build_runner build --delete-conflicting-outputs