Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

Tags:

flutter-run

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>
like image 335
Jonatas Brito Avatar asked Sep 06 '25 01:09

Jonatas Brito


1 Answers

Just run the below command:

flutter packages pub run build_runner build --delete-conflicting-outputs
like image 69
Faxriddin Abdullayev Avatar answered Sep 08 '25 00:09

Faxriddin Abdullayev