Gio.Task.is_valid

function is_valid(result: Gio.AsyncResult, source_object: GObject.Object): Boolean {
    // Gjs wrapper for g_task_is_valid()
}
  

Checks that result is a Gio.Task, and that source_object is its source object (or that source_object is null and result has no source object). This can be used in g_return_if_fail() checks.

Since 2.36

result

A Gio.AsyncResult

source_object

the source object expected to be associated with the task

Returns

true if result and source_object are valid, false if not