Skip to content

[flutter_svg] SvgPicture.defaultPlaceholderBuilder is never used #197006

Open
flutter/packages
#13599

Description

@palmoni5

Steps to reproduce

  1. Assign a global placeholder: SvgPicture.defaultPlaceholderBuilder = (_) => const Text('loading');
  2. Show an SvgPicture that loads asynchronously (for example SvgPicture.network(url) or SvgPicture.asset(name)) without passing placeholderBuilder.
  3. Look at the widget while the SVG is loading.

Expected results

The global SvgPicture.defaultPlaceholderBuilder is shown while the SVG loads, as its documentation says: "The default placeholder for a SVG that may take time to parse or retrieve, e.g. from a network location."

Actual results

Nothing is shown while loading. SvgPicture.build passes only the per-widget placeholderBuilder to VectorGraphic, so defaultPlaceholderBuilder is never used and assigning it has no effect.

Code sample

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

void main() {
  SvgPicture.defaultPlaceholderBuilder = (BuildContext context) => const Text('loading');
  runApp(
    MaterialApp(
      home: Scaffold(
        body: Center(
          child: SvgPicture.network('https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg'),
        ),
      ),
    ),
  );
}

Package version

flutter_svg 2.4.1 (current main of flutter/packages).

A fix is proposed in flutter/packages#13599.

Activity

  1. suryaKommana2662 commented on Nov 20, 2026

    @suryaKommana2662
    Contributor

    @palmoni5 Thanks for the report. I was able to reproduce this issue.

    After setting SvgPicture.defaultPlaceholderBuilder, the loading placeholder was not displayed while the SVG was loading. The SVG appeared directly on the screen without showing the configured placeholder. This matches the reported behavior. Routing to the team-engine for further investigation.

    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!
  2. added
    engine
    package
    in triage
    has reproducible steps
    team-engine
    p: flutter_svg
    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