Skip to content

BorderRadius.circular constructor should be const #146681

Closed as not planned
Closed as not planned
@mschlegelaware

Description

@mschlegelaware

Steps to reproduce

The named constructor BorderRadius.circular is not marked as const (even though it could be) and therefore it can not be used as default value in other constructors.

Expected results

BorderRadius.circular is marked as const as the other constructors (.vertical, .horizontal, .all etc.) and can be used for default values in other constructors.

Actual results

BorderRadius.circular can not be used as default value in other constructors.

Code sample

Code sample
  const WhiteTile({
    super.key,
    this.borderRadius = const BorderRadius.circular(8),
  });

/// Dart analyzer output:
/// The constructor being called isn't a const constructor. Try removing 'const' from the constructor invocation.
/// The default value of an optional parameter must be constant.

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.4.1 23E224 darwin-arm64, locale en-US)
    • Flutter version 3.13.9 on channel stable at /Users/XXX/fvm/versions/3.13.9
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (6 months ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/XXX/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/XXX/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.2

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.9+0-17.0.9b1087.7-11185874)

[✓] Connected device (2 available)
    • XXX’s iPhone (mobile)            • 00008110-001264242178401E            • ios • iOS 17.2.1 21C66
    • iPhone SE (3rd generation) (mobile) • 44047583-196A-476F-8493-910D1FBBF8AE • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)

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

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions