Build: Error: The setter 'useSummary' isn't defined for the class 'FolderBasedDartSdk'.

Created on 6 Jul 2020  路  14Comments  路  Source: dart-lang/build

Failure on travis: https://travis-ci.org/github/tekartik/sembast.dart/jobs/705520892

  • Dart SDK Version (dart --version)

2.8.4

  • What package(s) from this repo you are using, and the version (i.e. build_runner 0.7.12)

build_runner (no constraint)

  • What builder(s) you are using (or writing yourself). Try to give a short summary of what they do.

pub run build_runner test -- -p chrome

Failed to precompile build_runner:build_runner:
../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.9/lib/src/resolver.dart:329:7: Error: The setter 'useSummary' isn't defined for the class 'FolderBasedDartSdk'.
 - 'FolderBasedDartSdk' is from 'package:analyzer/src/dart/sdk/sdk.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.12/lib/src/dart/sdk/sdk.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named 'useSummary'.
    ..useSummary = false
      ^^^^^^^^^^
  • Whether you are using Windows, MacOSX, or Linux (if applicable)

Linux

  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable)

Chrome

  • Any other packages or constraints we should know about

test: 1.15.2 just updated

Most helpful comment

hot fix

dependencies:
  ...
  meta: '>=0.9.0 <1.2.0'

dev_dependencies:
  ...
  test: '<=1.15.2'
  build_runner: '>=1.0.0 <2.0.0'
  analyzer: '<=0.39.11' # https://github.com/dart-lang/build/issues/2745

All 14 comments

cc @scheglov

Is there a replacement for this?

https://github.com/dart-lang/build/blob/0ae4a8523cdfc976d7edc76b3279b2c56daa964d/build_resolvers/lib/src/resolver.dart#L328-L330

What is the migration path? Should we remove the assignment? Is there a min version we should use where it is safe to not assign this field?

The same thing, killed the assembly CI/CD

For now, it helps

dependency_overrides:
  analyzer: 0.39.11
  1. Yes, remove the assignment.

  2. More importantly, you should not do this at all. Analyzer now has buildSdkSummary, which you should use instead. It is available in 0.39.12.

hot fix

dependencies:
  ...
  meta: '>=0.9.0 <1.2.0'

dev_dependencies:
  ...
  test: '<=1.15.2'
  build_runner: '>=1.0.0 <2.0.0'
  analyzer: '<=0.39.11' # https://github.com/dart-lang/build/issues/2745

2. Analyzer now has buildSdkSummary, which you should use instead. It is available in 0.39.12.

Do you have a plan to move this into the public API so we don't get broken again the next time it's changed?

Its result is probably not very useful unless you use some other non-API things like SummaryDataStore, but I guess you have to start with something while building API surface. This function seems quite isolated and does not expose anything non-API itself, so yes, I will do this. Later you will able to switch once we publish a new analyzer version.

This should be resolved with a pub upgrade - you should pick up build_resolvers version 1.3.10 which has a fix.

It's all good now. Thanks @natebosch for the fast fix

I get this error too.

Exception: Error generating build_script snapshot: Failed to precompile build_runner:build_runner:
../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-1.3.7/lib/src/resolver.dart:332:7: Error: The setter 'useSummary' isn't defined for the class 'FolderBasedDartSdk'.

I do not have a direct dependency on build_resolvers and do not know which dependency pulls 1.3.7.
How can I force version 1.3.10?

Edit: my pubspec.lock file contains the following:

build_resolvers:
    dependency: transitive
    description:
      name: build_resolvers
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.3.10"

@natebosch do you have any idea what makes is use 1.3.7?

@Max-Might You can add build_resolvers: ^1.3.10 as a dependency to your pubspec. That should either fix your problem or tell you why you can't solve for that version. If it fails and you need help understanding the message you can comment with it here.

Edit: Actually it looks like your pubspec.lock is updated to the latest, so I am not totally sure what is happening. Is this a flutter project?

Yep, it is a Flutter 1.17.5 project.

Here is the pubspec file:

name: <redacted>
description: <redacted>

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.3.0+54

environment:
  sdk: ">=2.8.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  flutter_cupertino_localizations: ^1.0.1
  intl: ^0.16.1
  rxdart: ^0.24.1
  moor_flutter: ^3.0.0
  get_it: ^4.0.2
  dio: ^3.0.9
  encrypt: ^4.0.2
  flutter_secure_storage: ^3.3.3
  toast: ^0.1.5
  battery: ^1.0.1
  rx_shared_preferences: ^1.3.1
  tuple: ^1.0.3
  flutter_date_pickers: ^0.1.0
  badges: ^1.1.1
  sprintf: ^4.0.2
  auto_size_text: ^2.1.0
  device_info: ^0.4.2+4
  location:
    git:
      url: git://github.com/PrimeSwiftArt/flutterlocation.git
      ref: background-mode
  app_settings: ^3.0.1
  timezone: ^0.5.7
  get_version: ^0.2.2
  url_launcher: ^5.4.10
  image_picker: ^0.6.7+1
  file_picker: ^1.11.0+2
  path_provider: ^1.6.10
  open_file: ^3.0.1
  path: ^1.6.4
  crypto: ^2.1.3
  flutter_typeahead: ^1.8.3
  flutter_dialogs: 1.0.4
  flutter_slidable: ^0.5.4
  move_to_background: ^1.0.1
  uuid: 2.1.0

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter
  moor_generator: ^3.1.0
  r_flutter: ^0.6.0


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - lib/assets/images/
    - lib/assets/i18n/

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

builders:
  moor_generator: ^3.1.0
  r_flutter: ^0.6.0

r_flutter:
  intl: lib/assets/i18n/en.arb

I removed the builders section from the pubspeck file and now it seems to be working fine.

Oh, if you were using the builders section that probably indicates the problem, cc @jonahwilliams not sure if you want to do anything there or know more. I think that ends up creating a separate nested package and might be setting some old dependency constraints on build_* packages.

Was this page helpful?
0 / 5 - 0 ratings