Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Public Attributes | List of all members
io.flutter.embedding.engine.systemchannels.SpellCheckChannel Class Reference

Classes

interface  SpellCheckMethodHandler
 

Public Member Functions

 SpellCheckChannel (@NonNull DartExecutor dartExecutor)
 
void setSpellCheckMethodHandler ( @Nullable SpellCheckMethodHandler spellCheckMethodHandler)
 

Public Attributes

final MethodChannel channel
 
final MethodChannel.MethodCallHandler parsingMethodHandler
 

Detailed Description

SpellCheckChannel is a platform channel that is used by the framework to initiate spell check in the embedding and for the embedding to send back the results.

When there is new text to be spell checked, the framework will send to the embedding the message SpellCheck.initiateSpellCheck with the String locale to spell check with and the String of text to spell check as arguments. In response, the io.flutter.plugin.editing.SpellCheckPlugin will make a call to Android's spell check service to fetch spell check results for the specified text.

Once the spell check results are received by the io.flutter.plugin.editing.SpellCheckPlugin, it will send back to the framework the
ArrayList<HashMap<String,Object>>
of spell check results (see io.flutter.plugin.editing.SpellCheckPlugin#onGetSentenceSuggestions for details). The io.flutter.plugin.editing.SpellCheckPlugin only handles one request to fetch spell check results at a time; see io.flutter.plugin.editing.SpellCheckPlugin#initiateSpellCheck for details.

io.flutter.plugin.editing.SpellCheckPlugin implements SpellCheckMethodHandler to initiate spell check. Implement SpellCheckMethodHandler to respond to spell check requests.

Definition at line 37 of file SpellCheckChannel.java.

Constructor & Destructor Documentation

◆ SpellCheckChannel()

io.flutter.embedding.engine.systemchannels.SpellCheckChannel.SpellCheckChannel ( @NonNull DartExecutor  dartExecutor)
inline

Definition at line 75 of file SpellCheckChannel.java.

75 {
76 channel = new MethodChannel(dartExecutor, "flutter/spellcheck", StandardMethodCodec.INSTANCE);
78 }
void setMethodCallHandler(final @Nullable MethodCallHandler handler)

Member Function Documentation

◆ setSpellCheckMethodHandler()

void io.flutter.embedding.engine.systemchannels.SpellCheckChannel.setSpellCheckMethodHandler ( @Nullable SpellCheckMethodHandler  spellCheckMethodHandler)
inline

Sets the SpellCheckMethodHandler which receives all requests to spell check the specified text sent through this channel.

Definition at line 84 of file SpellCheckChannel.java.

85 {
86 this.spellCheckMethodHandler = spellCheckMethodHandler;
87 }

Member Data Documentation

◆ channel

final MethodChannel io.flutter.embedding.engine.systemchannels.SpellCheckChannel.channel

Definition at line 40 of file SpellCheckChannel.java.

◆ parsingMethodHandler

final MethodChannel.MethodCallHandler io.flutter.embedding.engine.systemchannels.SpellCheckChannel.parsingMethodHandler
Initial value:
=
new MethodChannel.MethodCallHandler() {
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
if (spellCheckMethodHandler == null) {
Log.v(
TAG,
"No SpellCheckeMethodHandler registered, call not forwarded to spell check API.");
return;
}
String method = call.method;
Object args = call.arguments;
Log.v(TAG, "Received '" + method + "' message.");
switch (method) {
case "SpellCheck.initiateSpellCheck":
try {
final ArrayList<String> argumentList = (ArrayList<String>) args;
String locale = argumentList.get(0);
String text = argumentList.get(1);
spellCheckMethodHandler.initiateSpellCheck(locale, text, result);
} catch (IllegalStateException exception) {
result.error("error", exception.getMessage(), null);
}
break;
default:
result.notImplemented();
break;
}
}
}
static void v(@NonNull String tag, @NonNull String message)
Definition: Log.java:40
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static ::testing::Matcher< GBytes * > MethodCall(const std::string &name, ::testing::Matcher< FlValue * > args)
GAsyncResult * result
void initiateSpellCheck( @NonNull String locale, @NonNull String text, @NonNull MethodChannel.Result result)
std::u16string text
void Log(const char *format,...) SK_PRINTF_LIKE(1
Definition: TestRunner.cpp:137
def call(args)
Definition: dom.py:159

Definition at line 44 of file SpellCheckChannel.java.


The documentation for this class was generated from the following file: