Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'flattenedToList' isn't defined for the class 'Iterable<List<Folder>>' #59925

Closed
RazorSai opened this issue Jan 17, 2025 · 2 comments
Closed
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@RazorSai
Copy link

when i try to run the command "dart run build_runner build --delete-conflicting-outputs", i'm getting the following error :-

`
Building package executable... (3.2s)
Failed to build build_runner:build_runner:
../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/analysis/driver.dart:706:39: Error: The getter 'flattenedToList' isn't defined for the class 'Iterable<List>'.

  • 'Iterable' is from 'dart:core'.
  • 'List' is from 'dart:core'.
  • 'Folder' is from 'package:analyzer/file_system/file_system.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/file_system/file_system.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flattenedToList'.
    var folders = packageMap.values.flattenedToList;
    ^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/fasta/ast_builder.dart:3136:31: Error: The getter 'flattenedToList' isn't defined for the class 'List<List>'.
  • 'List' is from 'dart:core'.
  • 'SwitchMemberImpl' is from 'package:analyzer/src/dart/ast/ast.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flattenedToList'.
    var members = membersList.flattenedToList;
    ^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/element/generic_inferrer.dart:567:14: Error: The getter 'flattenedToList' isn't defined for the class 'Iterable<List<MergedTypeConstraint<DartType, TypeParameterElementImpl2, PromotableElementImpl2, InterfaceTypeImpl, InterfaceElementImpl2>>>'.
  • 'Iterable' is from 'dart:core'.
  • 'List' is from 'dart:core'.
  • 'MergedTypeConstraint' is from 'package:_fe_analyzer_shared/src/type_inference/type_constraint.dart' ('../../../.pub-cache/hosted/pub.dev/_fe_analyzer_shared-79.0.0/lib/src/type_inference/type_constraint.dart').
  • 'DartType' is from 'package:analyzer/dart/element/type.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/dart/element/type.dart').
  • 'TypeParameterElementImpl2' is from 'package:analyzer/src/dart/element/element.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/element/element.dart').
  • 'PromotableElementImpl2' is from 'package:analyzer/src/dart/element/element.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/element/element.dart').
  • 'InterfaceTypeImpl' is from 'package:analyzer/src/dart/element/type.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/element/type.dart').
  • 'InterfaceElementImpl2' is from 'package:analyzer/src/dart/element/element.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/element/element.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flattenedToList'.
    .flattenedToList;
    ^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/analysis/library_analyzer.dart:619:8: Error: The getter 'flattenedToSet' isn't defined for the class 'Iterable<Iterable>'.
  • 'Iterable' is from 'dart:core'.
  • 'ErrorCode' is from 'package:_fe_analyzer_shared/src/base/errors.dart' ('../../../.pub-cache/hosted/pub.dev/_fe_analyzer_shared-79.0.0/lib/src/base/errors.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flattenedToSet'.
    }).flattenedToSet;
    ^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/analysis/library_graph.dart:200:10: Error: The getter 'flattenedToList' isn't defined for the class 'Iterable<List<LibraryFileKind?>>'.
  • 'Iterable' is from 'dart:core'.
  • 'List' is from 'dart:core'.
  • 'LibraryFileKind' is from 'package:analyzer/src/dart/analysis/file_state.dart' ('../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/dart/analysis/file_state.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flattenedToList'.
    .flattenedToList
    ^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/analyzer-7.2.0/lib/src/summary2/library_builder.dart:509:25: Error: The getter 'flattenedToList' isn't defined for the class 'List<List>'.
  • 'List' is from 'dart:core'.
  • 'MacroExecutionResult' is from 'package:_macros/src/executor.dart' ('../../flutter/flutter/bin/cache/dart-sdk/pkg/_macros/lib/src/executor.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flattenedToList'.
    _macroResults.flattenedToList,
    ^^^^^^^^^^^^^^^
    `
@dart-github-bot
Copy link
Collaborator

Summary: build_runner fails due to undefined flattenedToList getter on several Iterable and List types within the analyzer package. This suggests a missing helper function or a typo in the analyzer code.

@dart-github-bot dart-github-bot added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jan 17, 2025
@scheglov
Copy link
Contributor

You need new enough version of package:collection.
It looks that this method was added in 1.19.
And the analyzer requires

dependencies:
<cut>
  collection: ^1.19.0
<cut>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants