Skip to content

Reflectable >=4.0.6 incompatible with flutter_localizations #152984

Description

@gromanssp

Steps to reproduce

I want to migrate my project from version 3.13.9 to a higher version. I have tried several and all terno on the same problem. In this case the test is to raise it to 3.22.0.
1- I update the SDK and everything works fine.
2- I update the dependencies and the problem is due to version reflectable from version 4.06 to 4.07 or higher. This step is mandatory because reflectable 4.06 is not supported by this version of dart.
3- I try to run the project with 4.06 :

Expected results

Run the project

Actual results

Unhandled exception:
Crash when compiling file:///{local directory}/lib/main.reflectable.dart at character offset 17766:
type 'StructuralParameterType' is not a subtype of type 'TypeDeclarationType' in type cast

#0      StandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:kernel/src/standard_bounds.dart:976)
#1      TypeSchemaStandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:front_end/src/fasta/type_inference/standard_bounds.dart:59)
#2      StandardBounds._getNullabilityAwareStandardUpperBound (package:kernel/src/standard_bounds.dart:644)
#3      StandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:kernel/src/standard_bounds.dart:952)
#4      TypeSchemaStandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:front_end/src/fasta/type_inference/standard_bounds.dart:59)
#5      StandardBounds._getNullabilityAwareStandardUpperBound (package:kernel/src/standard_bounds.dart:644)
#6      StandardBounds._getNullabilityAwareFunctionStandardUpperBound (package:kernel/src/standard_bounds.dart:1467)
#7      StandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:kernel/src/standard_bounds.dart:802)
#8      TypeSchemaStandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:front_end/src/fasta/type_inference/standard_bounds.dart:59)
#9      StandardBounds._getNullabilityAwareStandardUpperBound (package:kernel/src/standard_bounds.dart:644)
#10     StandardBounds._getNullabilityAwareFunctionStandardUpperBound (package:kernel/src/standard_bounds.dart:1467)
#11     StandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:kernel/src/standard_bounds.dart:802)
#12     TypeSchemaStandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:front_end/src/fasta/type_inference/standard_bounds.dart:59)
#13     StandardBounds._getNullabilityAwareStandardUpperBound (package:kernel/src/standard_bounds.dart:644)
#14     StandardBounds.getStandardUpperBound (package:kernel/src/standard_bounds.dart:631)
#15     OperationsCfe.lub (package:front_end/src/fasta/type_inference/type_inference_engine.dart:830)
#16     OperationsCfe.typeSchemaLub (package:front_end/src/fasta/type_inference/type_inference_engine.dart:986)
#17     MergedTypeConstraint.mergeInTypeSchemaLower (package:_fe_analyzer_shared/src/type_inference/type_constraint.dart:150)
#18     MergedTypeConstraint.mergeIn (package:_fe_analyzer_shared/src/type_inference/type_constraint.dart:134)
#19     TypeConstraintGatherer.computeConstraints (package:front_end/src/fasta/type_inference/type_constraint_gatherer.dart:87)
#20     TypeSchemaEnvironment._chooseTypes (package:front_end/src/fasta/type_inference/type_schema_environment.dart:471)
#21     TypeSchemaEnvironment.chooseFinalTypes (package:front_end/src/fasta/type_inference/type_schema_environment.dart:459)
#22     InferenceVisitorImpl.visitMapLiteral (package:front_end/src/fasta/type_inference/inference_visitor.dart:4834)
#23     MapLiteral.accept1 (package:kernel/ast.dart:8341)
#24     InferenceVisitorImpl._inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:273)
#25     InferenceVisitorImpl.inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:305)
#26     InferenceVisitorBase._inferInvocation.inferArgument (package:front_end/src/fasta/type_inference/inference_visitor_base.dart:1809)
#27     InferenceVisitorBase._inferInvocation (package:front_end/src/fasta/type_inference/inference_visitor_base.dart:1873)
#28     InferenceVisitorBase.inferInvocation (package:front_end/src/fasta/type_inference/inference_visitor_base.dart:1558)
#29     InferenceVisitorImpl.visitConstructorInvocation (package:front_end/src/fasta/type_inference/inference_visitor.dart:1080)
#30     ConstructorInvocation.accept1 (package:kernel/ast.dart:6696)
#31     InferenceVisitorImpl._inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:273)
#32     InferenceVisitorImpl.inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:305)
#33     InferenceVisitorImpl.inferElement (package:front_end/src/fasta/type_inference/inference_visitor.dart:2605)
#34     InferenceVisitorImpl.visitListLiteral (package:front_end/src/fasta/type_inference/inference_visitor.dart:2703)
#35     ListLiteral.accept1 (package:kernel/ast.dart:8213)
#36     InferenceVisitorImpl._inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:273)
#37     InferenceVisitorImpl.inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:305)
#38     InferenceVisitorBase._inferInvocation.inferArgument (package:front_end/src/fasta/type_inference/inference_visitor_base.dart:1809)
#39     InferenceVisitorBase._inferInvocation (package:front_end/src/fasta/type_inference/inference_visitor_base.dart:1873)
#40     InferenceVisitorBase.inferInvocation (package:front_end/src/fasta/type_inference/inference_visitor_base.dart:1558)
#41     InferenceVisitorImpl.visitConstructorInvocation (package:front_end/src/fasta/type_inference/inference_visitor.dart:1080)
#42     ConstructorInvocation.accept1 (package:kernel/ast.dart:6696)
#43     InferenceVisitorImpl._inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:273)
#44     InferenceVisitorImpl.inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:305)
#45     InferenceVisitorImpl.inferMapEntry (package:front_end/src/fasta/type_inference/inference_visitor.dart:4576)
#46     InferenceVisitorImpl.visitMapLiteral (package:front_end/src/fasta/type_inference/inference_visitor.dart:4733)
#47     MapLiteral.accept1 (package:kernel/ast.dart:8341)
#48     InferenceVisitorImpl._inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:273)
#49     InferenceVisitorImpl.inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:305)
#50     TypeInferrerImpl.inferImplicitFieldType (package:front_end/src/fasta/type_inference/type_inferrer.dart:172)
#51     _ImplicitFieldTypeRoot.computeType (package:front_end/src/fasta/kernel/implicit_field_type.dart:157)
#52     SourceFieldBuilder.inferType.<anonymous closure> (package:front_end/src/fasta/source/source_field_builder.dart:524)
#53     SourceLoader.withUriForCrashReporting (package:front_end/src/fasta/source/source_loader.dart:283)
#54     SourceFieldBuilder.inferType (package:front_end/src/fasta/source/source_field_builder.dart:521)
#55     SourceFieldBuilder.inferTypes (package:front_end/src/fasta/source/source_field_builder.dart:512)
#56     InferableTypeBuilder.inferType (package:front_end/src/fasta/builder/omitted_type_builder.dart:163)
#57     SourceLoader.performTopLevelInference (package:front_end/src/fasta/source/source_loader.dart:2865)
#58     KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:531)
<asynchronous suspension>
#59     withCrashReporting (package:front_end/src/fasta/crash.dart:133)
<asynchronous suspension>
#60     KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:415)
<asynchronous suspension>
#61     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:367)
<asynchronous suspension>
#62     CompilerContext.clear (package:front_end/src/fasta/compiler_context.dart:139)
<asynchronous suspension>
#63     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:77)
<asynchronous suspension>
#64     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:617)
<asynchronous suspension>
#65     listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1311)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.

Exited (1).

Code sample

Code sample
$ flutter run
Launching lib\main.dart on 23129RA5FL in debug mode...
Running Gradle task 'assembleDebug'...                              6.0s
√ Built build\app\outputs\flutter-apk\app-debug.apk
Installing build\app\outputs\flutter-apk\app-debug.apk...          13.3s
Syncing files to device 23129RA5FL...                              110ms

Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on 23129RA5FL is available at: http://127.0.0.1:13023/U6AcP6ldLgs=/
I/com.example.bug(29000): Compiler allocated 4919KB to compile void android.view.ViewRootImpl.performTraversals()
E/libEGL  (29000): pre_cache appList: ,,
The Flutter DevTools debugger and profiler on 23129RA5FL is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:13023/U6AcP6ldLgs=/
D/VRI[MainActivity](29000): vri.reportNextDraw android.view.ViewRootImpl.performTraversals:3895 android.view.ViewRootImpl.doTraversal:2627 android.view.ViewRootImpl$TraversalRunnable.run:9680 android.view.Choreographer$CallbackRecord.run:1524 android.view.Choreographer$CallbackRecord.run:1532
E/libboost(29000): fail to open file: No such file or directory
E/libboost(29000): fail to open node: No such file or directory
D/VRI[MainActivity](29000): vri.Setup new sync id=0 syncSeqId=0
D/com.example.bug(29000): MiuiProcessManagerServiceStub setSchedFifo
I/MiuiProcessManagerImpl(29000): setSchedFifo pid:29000, mode:3
E/perf_hint(29000): Session creation failed, mPreferredRateNanos: -1
D/VRI[MainActivity](29000): vri.reportDrawFinished syncSeqId=0 android.view.ViewRootImpl.lambda$createSyncIfNeeded$4$android-view-ViewRootImpl:3963 android.view.ViewRootImpl$$ExternalSyntheticLambda1.run:6 android.os.Handler.handleCallback:942 android.os.Handler.dispatchMessage:99 android.os.Looper.loopOnce:211
D/DecorView[](29000): onWindowFocusChanged hasWindowFocus true
I/HandWritingStubImpl(29000): refreshLastKeyboardType: 1
I/HandWritingStubImpl(29000): getCurrentKeyboardType: 1
I/HandWritingStubImpl(29000): getCurrentKeyboardType: 1

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Versi¢n 10.0.22621.819], locale en-US)
    • Flutter version 3.22.0 on channel stable at C:\flutter\3.22.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (3 months ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\groma\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop Windows apps (Visual Studio Enterprise 2019 16.11.35)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
    • Visual Studio Enterprise 2019 version 16.11.34729.46
    • Windows 10 SDK version 10.0.19041.0
    X The current Visual Studio installation is incomplete.
      Please use Visual Studio Installer to complete the installation or reinstall Visual Studio.

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] VS Code (version 1.91.1)
    • VS Code at C:\Users\groma\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.92.0

[√] Connected device (4 available)
    • 23129RA5FL (mobile) • 1e4982a9 • android-arm64  • Android 13 (API 33)
    • Windows (desktop)   • windows  • windows-x64    • Microsoft Windows [Versi¢n 10.0.22621.819]
    • Chrome (web)        • chrome   • web-javascript • Google Chrome 126.0.6478.185
    • Edge (web)          • edge     • web-javascript • Microsoft Edge 126.0.2592.113

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: internationalizationSupporting other languages or locales. (aka i18n)dependency: dartDart team may need to help usframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions