Package io.flutter.plugin.editing
Class SpellCheckPlugin
- java.lang.Object
-
- io.flutter.plugin.editing.SpellCheckPlugin
-
- All Implemented Interfaces:
SpellCheckerSession.SpellCheckerSessionListener,SpellCheckChannel.SpellCheckMethodHandler
public class SpellCheckPlugin extends Object implements SpellCheckChannel.SpellCheckMethodHandler, SpellCheckerSession.SpellCheckerSessionListener
SpellCheckPluginis the implementation of all functionality needed for spell check for text input.The plugin handles requests for spell check sent by the
SpellCheckChannelvia sending requests to the Android spell checker. It also receives the spell check results from the service and sends them back to the framework through theSpellCheckChannel.
-
-
Constructor Summary
Constructors Constructor Description SpellCheckPlugin(TextServicesManager textServicesManager, SpellCheckChannel spellCheckChannel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Unregisters thisSpellCheckPluginas theSpellCheckChannel.SpellCheckMethodHandler, for theSpellCheckChannel, and closes the most recently openedSpellCheckerSession.voidinitiateSpellCheck(String locale, String text, MethodChannel.Result result)Initiates call to native spell checker to spell check specified text if there is no result awaiting a response.voidonGetSentenceSuggestions(SentenceSuggestionsInfo[] results)Callback for Android spell check API that decomposes results and send results through theSpellCheckChannel.voidonGetSuggestions(SuggestionsInfo[] results)voidperformSpellCheck(String locale, String text)Calls on the Android spell check API to spell check specified text.
-
-
-
Constructor Detail
-
SpellCheckPlugin
public SpellCheckPlugin(@NonNull TextServicesManager textServicesManager, @NonNull SpellCheckChannel spellCheckChannel)
-
-
Method Detail
-
destroy
public void destroy()
Unregisters thisSpellCheckPluginas theSpellCheckChannel.SpellCheckMethodHandler, for theSpellCheckChannel, and closes the most recently openedSpellCheckerSession.Do not invoke any methods on a
SpellCheckPluginafter invoking this method.
-
initiateSpellCheck
public void initiateSpellCheck(@NonNull String locale, @NonNull String text, @NonNull MethodChannel.Result result)Initiates call to native spell checker to spell check specified text if there is no result awaiting a response.- Specified by:
initiateSpellCheckin interfaceSpellCheckChannel.SpellCheckMethodHandler
-
performSpellCheck
public void performSpellCheck(@NonNull String locale, @NonNull String text)Calls on the Android spell check API to spell check specified text.
-
onGetSentenceSuggestions
public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results)
Callback for Android spell check API that decomposes results and send results through theSpellCheckChannel.Spell check results will be encoded as a string representing the span of that result, with the format "start_index.end_index.suggestion_1/nsuggestion_2/nsuggestion_3", where there may be up to 5 suggestions.
- Specified by:
onGetSentenceSuggestionsin interfaceSpellCheckerSession.SpellCheckerSessionListener
-
onGetSuggestions
public void onGetSuggestions(SuggestionsInfo[] results)
- Specified by:
onGetSuggestionsin interfaceSpellCheckerSession.SpellCheckerSessionListener
-
-