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

[Flutter] flutter pub run build_runner build is Deprecated

Discussão em 'Mobile' iniciado por Stack, Setembro 27, 2024 às 14:23.

  1. Stack

    Stack Membro Participativo

    When I run flutter pub run build_runner build --delete-conflicting-outputs, I get this error:

    Deprecated. Use `dart run` instead.
    [INFO] Generating build script completed, took 169ms
    [WARNING] ../../../.pub-cache/hosted/pub.dev/built_value_generator-8.6.1/lib/src/dart_types.dart:65:21: Error: 'InvalidType' isn't a type.
    if (dartType is InvalidType) {
    ^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/built_value_generator-8.6.1/lib/src/value_source_class.dart:497:20: Error: The getter 'name2' isn't defined for the class 'NamedType'.
    - 'NamedType' is from 'package:analyzer/dart/ast/ast.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-5.7.1/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'name2'.
    if (type.name2.lexeme == 'Built') {
    ^^^^^
    [INFO] Precompiling build script... completed, took 547ms
    [SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
    This is likely caused by a misconfigured builder definition.


    So I run dart run build_runner build --delete-conflicting-outputs instead and I get this error:

    [INFO] Generating build script completed, took 172ms
    [WARNING] ../../../.pub-cache/hosted/pub.dev/built_value_generator-8.6.1/lib/src/dart_types.dart:65:21: Error: 'InvalidType' isn't a type.
    if (dartType is InvalidType) {
    ^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/built_value_generator-8.6.1/lib/src/value_source_class.dart:497:20: Error: The getter 'name2' isn't defined for the class 'NamedType'.
    - 'NamedType' is from 'package:analyzer/dart/ast/ast.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-5.7.1/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'name2'.
    if (type.name2.lexeme == 'Built') {
    ^^^^^
    [INFO] Precompiling build script... completed, took 570ms
    [SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
    This is likely caused by a misconfigured builder definition.


    I tried adding gql: 0.13.0 to dependency_overrides but again I got the same error!

    I'm using Flutter (Channel stable, 3.10.5, on macOS 13.2.1 22D68 darwin-arm64, locale en-US) and build_runner: ^2.4.5

    How do I fix it?

    Continue reading...

Compartilhe esta Página