Skip to content

Commit

Permalink
chore: wrap unit calls with boolean result (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 authored Sep 4, 2024
1 parent 97d92e7 commit 1635acf
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ internal fun <R> MethodCall.invokeNative(
try {
@Suppress("UNCHECKED_CAST")
val params = this.arguments as? Map<String, Any> ?: emptyMap()
result.success(performAction(params))
val actionResult = performAction(params)
if (actionResult is Unit) {
result.success(true)
} else {
result.success(actionResult)
}
} catch (ex: Exception) {
result.error(this.method, ex.localizedMessage, ex)
}
Expand Down

0 comments on commit 1635acf

Please sign in to comment.