1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Flutter - Build_runner doesn't generate files for my imported package

Discussão em 'Mobile' iniciado por Stack, Outubro 31, 2024 às 13:22.

  1. Stack

    Stack Membro Participativo

    I created a small library to gather all my widgets in one place. Recently, I added the complete logic for my authentication page (Dio, Retrofit, Repository, Manager, etc.) to avoid recreating this page every time I want to create a new app.

    However, in my authentication repository, for example, I'm using Retrofit, so I implemented something like this:

    import "package:dio/dio.dart";
    import "package:retrofit/retrofit.dart";

    part "authentication_repository.g.dart";

    @RestApi()
    abstract class AuthenticationClient {
    factory AuthenticationClient(Dio dio) = _AuthenticationClient;
    ....


    So, I need to have the build_runner to create the .g.dart file. I added it in the pubspec:

    dev_dependencies:
    flutter_test:
    sdk: flutter
    flutter_lints: ^3.0.1

    retrofit_generator: ">=7.0.0 <8.0.0"
    build_runner: 2.4.12
    json_serializable: 6.8.0
    custom_lint: 0.6.2


    I pushed my library to Git and imported it into my main project.

    The problem is that the build_runner in my main project can't generate the .g.dart files for my authrepo inside my library.


    ....authentication_repository.g.dart': File not found

    How can I do that?

    Thanks

    (I have this error only when i'm starting my app)

    Continue reading...

Compartilhe esta Página