fetch method Null safety

Future<ParseObject> fetch()

Fetches this object with the data from the server. Call this whenever you want the state of the object to reflect exactly what is on the server.

Implementation

Future<ParseObject> fetch() async {
  if (objectId == null || objectId!.isEmpty) {
    throw 'can not fetch without a objectId';
  }

  final ParseResponse response = await getObject(objectId!);

  if (response.success && response.results != null) {
    return response.results!.first;
  } else {
    return this;
  }
}