From 035eeb532e29810689c9c8809e79d080476f5c24 Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Wed, 9 Mar 2022 10:36:09 -0800 Subject: [PATCH] updateEditingValueWithDeltas snippet docs fix (#99570) Just a docs change for a broken tool snippet. --- packages/flutter/lib/src/services/text_input.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index c3a8a15f8a7..bc3f66b14f5 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -1195,16 +1195,23 @@ abstract class DeltaTextInputClient extends TextInputClient { /// to the client's editing state. A change is any mutation to the raw text /// value, or any updates to the selection and/or composing region. /// - /// Here is an example of what implementation of this method could look like: /// {@tool snippet} + /// This example shows what an implementation of this method could look like. + /// + /// ```dart + /// TextEditingValue? _localValue; /// @override /// void updateEditingValueWithDeltas(List textEditingDeltas) { - /// TextEditingValue newValue = _previousValue; + /// if (_localValue == null) { + /// return; + /// } + /// TextEditingValue newValue = _localValue!; /// for (final TextEditingDelta delta in textEditingDeltas) { /// newValue = delta.apply(newValue); /// } /// _localValue = newValue; /// } + /// ``` /// {@end-tool} void updateEditingValueWithDeltas(List textEditingDeltas); }