isValidJson method
Check if the object
is a valid enum.
Implementation
bool isValidJson(Object? object) {
try {
final decoded = jsonDecode(object.toString()) as Map;
return decoded['type'] == r'$IsolateState' && decoded['value'] == name;
} catch (_) {}
return false;
}