diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 3bf20e55fb..8f234ef76f 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -2125,6 +2125,28 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im /// [describeSemanticsConfiguration] call (for example as a result of /// asynchronous computation) will at best have no useful effect and at worse /// will cause crashes as the data will be in an inconsistent state. + /// + /// ## Sample code + /// + /// The following snippet will describe the node as a button that responds to + /// tap actions. + /// + /// ```dart + /// abstract class SemanticButtonRenderObject extends RenderObject { + /// @override + /// void describeSemanticsConfiguration(SemanticsConfiguration config) { + /// super.describeSemanticsConfiguration(config); + /// config + /// ..addAction(SemanticsAction.tap, _handleTap) + /// ..label = 'I am a button' + /// ..isButton = true; + /// } + /// + /// void _handleTap() { + /// // Do something. + /// } + /// } + /// ``` @protected void describeSemanticsConfiguration(SemanticsConfiguration config) { // Nothing to do by default.