Skip to content

[flutter_svg] SvgPicture diagnostics always report the default clipBehavior #197014

Done
flutter/packages
#13600

Description

@palmoni5

Steps to reproduce

  1. Create an SvgPicture without passing clipBehavior, so it uses the constructor default Clip.hardEdge.
  2. Inspect its diagnostics, for example with toStringDeep() or in the widget inspector.

Expected results

clipBehavior is omitted from the diagnostics because it has its default value, like the other properties of SvgPicture.

Actual results

clipBehavior: hardEdge is always listed. SvgPicture.debugFillProperties passes defaultValue: BoxFit.contain for the Clip property, which can never be equal to a Clip value.

Code sample

import 'package:flutter/foundation.dart';
import 'package:flutter_svg/flutter_svg.dart';

void main() {
  final SvgPicture picture = SvgPicture.string('<svg width="10" height="10"></svg>');
  final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
  picture.debugFillProperties(builder);
  for (final DiagnosticsNode property in builder.properties) {
    if (!property.isFiltered(DiagnosticLevel.info)) {
      print(property);  // Prints "clipBehavior: hardEdge".
    }
  }
}

Package version

flutter_svg 2.5.0 (current main of flutter/packages).

A fix is proposed in flutter/packages#13600.

Activity

  1. added
    in triage
    on Nov 20, 2026
  2. suryaKommana2662 commented on Nov 20, 2026

    @suryaKommana2662
    Contributor

    @palmoni5 Thanks for the report. I was able to reproduce this issue on an iPhone 18 Pro.

    The diagnostics output includes clipBehavior: hardEdge. The behavior matches the reported issue. Routing to the team-engine for further investigation.

    flutter: "Instance of 'SvgStringLoader'"
    flutter: clipBehavior: hardEdge
    flutter: colorFilter: "null"
    

    Flutter Doctor Output

    [✓] Flutter (Channel stable, 3.50.0, on macOS 27.0 26A428 darwin-arm64, locale en-IN) [691ms]
        • Flutter version 3.50.0 on channel stable at /Users/suryakommana/develop/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ab2912035e (10 days ago), 2026-11-09 08:50:21 -0800
        • Engine revision 371f77202a
        • Dart version 3.14.0
        • DevTools version 2.61.0
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
          enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [4.2s]
        • Android SDK at /Users/suryakommana/Library/Android/sdk
        • Emulator version 37.2.13.0 (build_id 16740729) (CL:N/A)
        • Platform android-37.0, build-tools 36.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 25.0.2+-15348964-b329.117)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 27.2) [1,981ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 27B52
        • CocoaPods version 1.17.0
    
    [✓] Chrome - develop for the web [3ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (3 available) [5.8s]
        • iPhone 18 Pro (mobile) • D80F2104-E911-4251-BEDD-E67D9B7EBF58 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-27-0 (simulator)
        • macOS (desktop)        • macos                                • darwin-arm64   • macOS 27.0 26A428 darwin-arm64
        • Chrome (web)           • chrome                               • web-javascript • Google Chrome 158.0.8127.36
    
    [✓] Network resources [606ms]
        • All expected network resources are available.
    
    • No issues found!
  3. added
    engine
    package
    team-engine
    p: flutter_svg
    has reproducible steps
    and removed
    in triage
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enginehas reproducible stepsp: flutter_svgpackageteam-engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions