Open amandaoneal opened 2 years ago
There is an implementation for the delete()
and deleteAll()
function.
I can't reproduce your issue. Can you provide more information like an error message or something else?
I'm on Flutter 3.0.2 / Dart 2.17.3 / DevTools 2.12.2. This is happening on iOS in particular (haven't tested on Android yet).
There's no error message that I'm aware of, it just hangs (from Dart's perspective anyway)
Dart Code:
print("here1");
await prefs.setString(ServerHandler.fcmTokenKey, token);
print("here2");
await cloudKit.delete(ServerHandler.fcmTokenKey);
print("here3");
In the above code, it prints "here1" and "here2" but never prints "here3", it just sits indefinitely on the delete() line.
I was able to fix it locally by adding a result() call inside SwiftCloudPlugin.swift:
case "delete":
...
if record.value(forKey: key) != nil {
database.delete(withRecordID: record.recordID) { (recordId, error) in
result(true) //ADDED THIS LINE
}
}
I haven't yet figured out how to fix it for deleteAll because (1) I'm not super familiar with Swift closures and (2) I don't need to use deleteAll for my code. But I assume a similar fix would work for deleteAll?
When I try to call the delete method, it hangs indefinitely. I think it's related to the fact that SwiftCloudPlugin.swift doesn't have a result() call for the delete case, so while it does perform the operation, it doesn't actually end the method and return back to Flutter. If this is the case, I suspect deleteAll would have the same issue, though I haven't tested that one.