Error: The language version override has to be the same in the library and its part(s)

753

I got a similar error when part of my flutter install was corrupted. I solved it by running reloading my flutter using flutter channel beta flutter upgrade flutter channel stable flutter upgrade

Share:
753
Taleb
Author by

Taleb

I am Taleb Rafiepour, an experienced iOS , Android & Flutter Developer with a demonstrated history of working in the information technology and services industry. Skilled in Mobile Application Development, Swift(iOS Development), Java & Kotlin (Android Development) & Dart (Flutter Development). Strong engineering professional with an Associate’s degree focused in Computer Software Engineering from Persian Gulf University.

Updated on December 16, 2022

Comments

  • Taleb
    Taleb over 1 year

    I created a project and added https://github.com/google/inject.dart to my project but when i want to generate dependency injection I got below Error when i want to build DI with flutter packages pub run build_runner build

    [INFO] Generating build script...
    [INFO] Generating build script completed, took 489ms
    
    [INFO] Creating build script snapshot......
    [INFO] Creating build script snapshot... completed, took 9.2s
    
    [SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
    This is likely caused by a misconfigured builder definition.
    [SEVERE] lib/q35/injection/inject.dart/package/inject_generator/lib/src/graph.dart:20:6: Error: The language version override has to be the same in the library and its part(s).
    part 'graph/injector_graph.dart';
         ^
    lib/q35/injection/inject.dart/package/inject_generator/lib/src/graph.dart:21:6: Error: The language version override has to be the same in the library and its part(s).
    part 'graph/injector_graph_resolver.dart';
         ^
    lib/q35/injection/inject.dart/package/inject_generator/lib/src/graph.dart:22:6: Error: The language version override has to be the same in the library and its part(s).
    part 'graph/summary_reader.dart';
         ^
    lib/q35/injection/inject.dart/package/inject_generator/lib/src/summary.dart:14:6: Error: The language version override has to be the same in the library and its part(s).
    part 'summary/injectable_summary.dart';
         ^
    lib/q35/injection/inject.dart/package/inject_generator/lib/src/summary.dart:15:6: Error: The language version override has to be the same in the library and its part(s).
    part 'summary/injector_summary.dart';
         ^
    lib/q35/injection/inject.dart/package/inject_generator/lib/src/summary.dart:16:6: Error: The language version override has to be the same in the library and its part(s).
    part 'summary/library_summary.dart';
         ^
    lib/q35/injection/inject.dart/package/inject_generator/lib/src/summary.dart:17:6: Error: The language version override has to be the same in the library and its part(s).
    part 'summary/module_summary.dart';
         ^
    lib/q35/injection/inject.dart/package/inject_generator/lib/src/summary.dart:18:6: Error: The language version override has to be the same in the library and its part(s).
    part 'summary/provider_summary.dart';
         ^
    
    pub finished with exit code 78
    
    
    

    and here is my inject_generator_build.yaml:

    # Read about `build.yaml` at https://pub.dartlang.org/packages/build_config
    builders:
      inject_generator:
        target: ":inject_generator"
        import: "package:inject_generator/inject_generator.dart"
        builder_factories:
          - "summarizeBuilder"
          - "generateBuilder"
        build_extensions:
          ".dart":
            - ".inject.summary"
            - ".inject.dart"
        auto_apply: dependents
        build_to: source
    
    
    • Taleb
      Taleb over 3 years
      I finally solved this issue when i update inject.dart library to dart version 2