I know we can call FlutterResult to send data from native plugin to dart like this:
// swift func
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
result("send something to dart")
}
But I run into a more tricky situcation. I'm calling NSFileCoordinator.coordinate, I only have file access in callback function:
NSFileCoordinator().coordinate(readingItemAt: url, error: &error) { (url) in
// you have access
}
I'm hoping I can call dart code synchronously to read the file so that I wouldn't lose file access.
NSFileCoordinator().coordinate(readingItemAt: url, error: &error) { (url) in
// Call dart code to read the file and block the current thread!!!
}
Seems not possible.