Open pszklarska opened 4 years ago
I see the same issue when using the flutter inspector. If I click on a widget that contains a SvgPicture it dumps this stack trace and the widget and all its children can't be inspected: ════════ Exception caught by Flutter framework ═════════════════════════════════════════════════════ The following assertion was thrown during a service extension callback for "ext.flutter.inspector.getDetailsSubtree": type 'PictureStream' is not a subtype of type 'Diagnosticable'
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=BUG.md
When the exception was thrown, this was the stack:
... ════════════════════════════════════════════════════════════════════════════════════════════════════
What version of Flutter are you on?
There were changes to both Flutter svg and Flutter recently that are impacting this.
This is on flutter stable channel version 1.12.13+hotfix.9. flutter_svg: ^0.17.3+1 I will test it again when I have upgraded to flutter 1.17
In Flutter 1.17 this error is gone, and it is working as expected.
@pszklarska
Hello
You put the code before expect
line.
await tester.pumpAndSettle();
It waits drawing.
I'm having a similar problem on a integration test. Rendering a tree like so:
...
Expanded(
flex: 1,
child: GestureDetector(
onTap: () async => await doSomething(),
child: Center(
child: SvgPicture.asset(
'images/some.svg',
key: Key('find_me'),
),
),
),
),
...
The widget tester is unable to find a widget to tap with the code:
group('', () {
testWidgets('', (tester) async {
await tester.pumpWidget(MyWidget());
await tester.pumpAndSettle();
await tester.tap(find.byKey(Key('find_me')));
// await tester.tap(find.byType(SvgPicture).last); // this also doesn't work
await tester.pumpAndSettle();
// expectations for the onTap...
}
);
});
All that I get is an error:
The following StateError was thrown running a test:
Bad state: No element
If I put an await Future.delayed(Duration(seconds: 5));
to see the screen, the svg is rendered but, when clicking on it, on the console is printed:
No widgets found at Offset(171.4, 656.3).
Any hints on how to find it?
I'm trying to write tests for the widgets that use SvgPicture. The following test can be run successfully:
However, when I add
debugDumpApp
method to print current widgets' tree, test fails:The exception stack trace is: