implement static method
NSTextElementProvider
implement({
- required NSTextRange documentRange(),
- required NSTextLocation? enumerateTextElementsFromLocation_options_usingBlock_(
- NSTextLocation?,
- NSTextContentManagerEnumerationOptions,
- ObjCBlock<
Bool Function(NSTextElement)>
- required void replaceContentsInRange_withTextElements_(
- NSTextRange,
- NSArray?
- required void synchronizeToBackingStore_(
- ObjCBlock<
Void Function(NSError?)> ?
- ObjCBlock<
- NSTextLocation? locationFromLocation_withOffset_()?,
- DartNSInteger offsetFromLocation_toLocation_()?,
- NSTextRange? adjustedRangeFromRange_forEditingTextSelection_()?,
- bool $keepIsolateAlive = true,
Builds an object that implements the NSTextElementProvider protocol. To implement
multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly.
If $keepIsolateAlive is true, this protocol will keep this isolate
alive until it is garbage collected by both Dart and ObjC.
Implementation
static NSTextElementProvider implement({
required NSTextRange Function() documentRange,
required NSTextLocation? Function(
NSTextLocation?,
NSTextContentManagerEnumerationOptions,
objc.ObjCBlock<ffi.Bool Function(NSTextElement)>,
)
enumerateTextElementsFromLocation_options_usingBlock_,
required void Function(NSTextRange, objc.NSArray?)
replaceContentsInRange_withTextElements_,
required void Function(objc.ObjCBlock<ffi.Void Function(objc.NSError?)>?)
synchronizeToBackingStore_,
NSTextLocation? Function(NSTextLocation, DartNSInteger)?
locationFromLocation_withOffset_,
DartNSInteger Function(NSTextLocation, NSTextLocation)?
offsetFromLocation_toLocation_,
NSTextRange? Function(NSTextRange, bool)?
adjustedRangeFromRange_forEditingTextSelection_,
bool $keepIsolateAlive = true,
}) {
final builder = objc.ObjCProtocolBuilder(
debugName: 'NSTextElementProvider',
);
NSTextElementProvider.documentRange.implement(builder, documentRange);
NSTextElementProvider.enumerateTextElementsFromLocation_options_usingBlock_
.implement(
builder,
enumerateTextElementsFromLocation_options_usingBlock_,
);
NSTextElementProvider.replaceContentsInRange_withTextElements_.implement(
builder,
replaceContentsInRange_withTextElements_,
);
NSTextElementProvider.synchronizeToBackingStore_.implement(
builder,
synchronizeToBackingStore_,
);
NSTextElementProvider.locationFromLocation_withOffset_.implement(
builder,
locationFromLocation_withOffset_,
);
NSTextElementProvider.offsetFromLocation_toLocation_.implement(
builder,
offsetFromLocation_toLocation_,
);
NSTextElementProvider.adjustedRangeFromRange_forEditingTextSelection_
.implement(builder, adjustedRangeFromRange_forEditingTextSelection_);
builder.addProtocol($protocol);
return NSTextElementProvider.castFrom(
builder.build(keepIsolateAlive: $keepIsolateAlive),
);
}