Skip to content

A SemanticsData object with label "My Label" had a null textDirection. #175532

Description

@jtanium

Steps to reproduce

Create an SvgPicture with a semanticsLabel, but no directionality?

I'm only creating this issue because the stacktrace suggested it, and I couldn't find any existing issues related to this.

Expected results

Expected not to get a stacktrace in the console

Actual results

Got an exception.

Code sample

Code sample
    return SvgPicture.asset(
      assetPath,
      width: width,
      height: height,
      colorFilter: ColorFilter.mode(color ?? Colors.black, BlendMode.srcIn),
      semanticsLabel: 'My Label',
    );
Resolution
return Directionality(
      textDirection: TextDirection.ltr,
      child: SvgPicture.asset(
        assetPath,
        width: width,
        height: height,
        colorFilter: ColorFilter.mode(color ?? Colors.black, BlendMode.srcIn),
        semanticsLabel: 'My Label',
      ),
    );

Screenshots or Video

Screenshots / Video demonstration

N/A

Logs

Logs
══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
A SemanticsData object with label "TRACER Logo" had a null textDirection.
'package:flutter/src/semantics/semantics.dart':
Failed assertion: line 959 pos 10: 'attributedLabel.string == '' || textDirection != null'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=02_bug.yml

When the exception was thrown, this was the stack:
#2      new SemanticsData (package:flutter/src/semantics/semantics.dart:959:10)
#3      SemanticsNode.getSemanticsData (package:flutter/src/semantics/semantics.dart:3537:12)
#4      SemanticsNode._addToUpdate (package:flutter/src/semantics/semantics.dart:3581:32)
#5      SemanticsOwner.sendSemanticsUpdate (package:flutter/src/semantics/semantics.dart:4345:14)
#6      PipelineOwner.flushSemantics (package:flutter/src/rendering/object.dart:1499:24)
#7      PipelineOwner.flushSemantics (package:flutter/src/rendering/object.dart:1501:15)
#8      RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:636:25)
#9      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1261:13)
#10     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:495:5)
#11     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1434:15)
#12     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1347:9)
#13     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1200:5)
#14     _invoke (dart:ui/hooks.dart:330:13)
#15     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:444:5)
#16     _drawFrame (dart:ui/hooks.dart:302:31)
(elided 2 frames from class _AssertionError)
════════════════════════════════════════════════════════════════════════════════════════════════════

flutter: unhandled element <style/>; Picture key: Svg loader

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.35.4, on macOS 15.6.1 24G90 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2025.1.5.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)a: error messageError messages from the Flutter frameworkc: crashStack traces logged to the consoleframeworkflutter/packages/flutter repository. See also f: labels.p: flutter_svgThe Flutter SVG drawing packagespackageflutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamworkaround availableThere is a workaround available to overcome the issue

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions