77 inLanguage:(NSString*)language {
78
79 if ([language containsString:@"-"]) {
80 NSArray<NSString*>* languageCodes = [language componentsSeparatedByString:@"-"];
82 NSString* lastCode = [[languageCodes lastObject] uppercaseString];
83 language = [NSString stringWithFormat:@"%@_%@", [languageCodes firstObject], lastCode];
84 }
85
86 if (![UITextChecker.availableLanguages containsObject:language]) {
87 return nil;
88 }
89
90 NSMutableArray<FlutterSpellCheckResult*>* allSpellSuggestions = [[NSMutableArray alloc] init];
91
93 NSUInteger nextOffset = 0;
94 do {
95 nextSpellSuggestion = [self findSpellCheckSuggestionsForText:text
96 inLanguage:language
97 startingOffset:nextOffset];
98 if (nextSpellSuggestion != nil) {
99 [allSpellSuggestions addObject:nextSpellSuggestion];
100 nextOffset =
102 }
103 }
while (nextSpellSuggestion != nil && nextOffset <
text.length);
104
105 NSMutableArray* methodChannelResult =
106 [[NSMutableArray alloc] initWithCapacity:allSpellSuggestions.count];
107
109 [methodChannelResult addObject:[result toDictionary]];
110 }
111
112 return methodChannelResult;
113}
#define FML_DCHECK(condition)