Code causing `dartdoc` errors and run-time crash. Bad code, bad analysers (or both)?

55 views
Skip to first unread message

Hugo van Galen

unread,
Sep 8, 2017, 5:29:10 AM9/8/17
to Flutter Dev
The code below demonstrates two issues that I ran into, and I am unsure if I am doing wrong, or if these are bugs.

It causes the following run-time crash:
I/flutter (18372): The following assertion was thrown while finalizing the widget tree:
I/flutter (18372): _TestWidgetState.dispose failed to call super.dispose.
I/flutter (18372): dispose() implementations must always call their superclass dispose() method, to ensure that all the
I/flutter (18372): resources used by the widget are fully released.

Explicitly implementing a dispose() method that calls super.dispose() does not change the situation. I do not get what causes this, and I would like to understand (possibly the analyser should have picked up on it if invalid code?)

This same code also demonstrates errors when running `dartdoc` on the code. The generation fails with the message:
[error] The class 'TickerProviderStateMixin' can't be used as a mixin because it extends a class other than Object.

import 'package:flutter/material.dart';

abstract class _TestState<T extends StatefulWidget> extends State<T> {
@override
Widget build(BuildContext context);
}

class TestWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() => new _TestWidgetState();
}

class _TestWidgetState extends _TestState<TestWidget> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) => const Text( "foo" );
}
I like to understand why these two issues occur. Thanks in advance for any replies.

Cheers,
Hugo

Ian Hickson

unread,
Sep 8, 2017, 12:26:33 PM9/8/17
to Hugo van Galen, Flutter Dev
I don't see any error when I put the code above into the "flutter create" template and replace the "body" of the Scaffold with a "new TestWidget()".

Can you file a bug with a self-contained main.dart that shows the problem?


--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

--
Ian Hickson

😸
Reply all
Reply to author
Forward
0 new messages