ParseObject class
The ParseObject is a local representation of data that can be saved and retrieved from the Parse cloud.
The basic workflow for creating new data is to construct a new ParseObject, use ParseObject.set to fill it with data, and then use ParseObject.save to persist to the cloud.
The basic workflow for accessing existing data is to use a ParseQuery to specify which existing data to retrieve.
- Implementers
Constructors
- ParseObject({required String className, String? objectId, dynamic json})
- Constructs a new ParseObject
- ParseObject.fromJson({required dynamic json})
-
factory
Properties
- asMap → dynamic
-
Return
Map<String, dynamic>
of complete data objectno setter - asPointer → dynamic
-
Return
Map<String, dynamic>
of pointer objectno setter - className → String
-
Accessor to the class name.
final
- copy → ParseObject
-
Return the copy of this instance
no setter
- createdAt → DateTime?
-
This reports time as the server sees it, so that if you create a ParseObject, then wait a
while, and then call save, the creation time will be the time of the first
save call rather than the time the object was created locally.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isComplete → bool
-
Return true if this object already fetched
no setter
- isDeleted → bool
-
Return true if this is already deleted
no setter
- objectId → String?
-
Accessor to the object id. An object id is assigned as soon as an object is saved to the
server. The combination of a className and an objectId uniquely identifies an object in your
application.
no setter
-
operations
→ Map<
String, dynamic> -
no setter
- path → String
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- updatedAt → DateTime?
-
This reports time as the server sees it, so that if you make changes to a ParseObject, then
wait a while, and then call save, the updated time will be the time of the
save call rather than the time the object was changed locally.
no setter
Methods
-
add(
String key, dynamic value) → void - Atomically adds an object to the end of the array associated with a given key.
-
addAll(
String key, List values) → void - Atomically adds the objects contained in a List to the end of the array associated with a given key.
-
addAllUnique(
String key, List values) → void - Atomically adds the objects contained in a List to the array associated with a given key, only adding elements which are not already present in the array. The position of the insert is not guaranteed.
-
addUnique(
String key, dynamic value) → void - Atomically adds an object to the array associated with a given key, only if it is not already present in the array. The position of the insert is not guaranteed.
-
decrement(
dynamic key, {int by = -1}) → void - Atomically decrements the given key by the given number.
-
delete(
{bool useMasterKey = false}) → Future< void> - Deletes this object on the server.
-
fetch(
{List< String> ? includes, bool useMasterKey = false}) → Future<ParseObject> - Fetches this object with the data from the server.
-
fetchIfNeeded(
{bool useMasterKey = false}) → Future< ParseObject> -
If this
ParseObject
has not been fetched (i.e. isComplete returnsfalse
), fetches this object with the data from the server. -
get(
String key) → dynamic - Access a value. In most cases it is more convenient to use a helper function such as getString or getInteger.
-
getBoolean(
String key) → bool? - Access a bool value.
-
getDateTime(
String key) → DateTime? - Access a DateTime value.
-
getDouble(
String key) → double? - Access a double value.
-
getInteger(
String key) → int? - Access an int value.
-
getList<
T> (String key) → List< T> ? - Access a List value.
-
getMap<
T> (String key) → Map< String, T> ? - Access a Map value.
-
getNumber(
String key) → num? - Access a num value.
-
getParseACL(
) → ParseACL? - Access a ParseACL value.
-
getParseFile(
String key) → ParseFile? - Access a ParseFile value.
-
getParseGeoPoint(
String key) → ParseGeoPoint? - Access a ParseGeoPoint value.
-
getParseObject(
String key) → ParseObject? - Access a ParseObject value.
-
getParseRole(
String key) → ParseRole? - Access a ParseRole value.
-
getParseUser(
String key) → ParseUser? - Access a ParseUser value.
-
getString(
String key) → String? - Access a String value.
-
increment(
dynamic key, {int by = 1}) → void - Atomically increments the given key by the given number.
-
isKeyMutable(
String key) → bool -
mergeJson(
dynamic json, {bool fromFetch = false}) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
String key) → void - Removes a key from this object's data if it exists.
-
removeAll(
String key, List values) → void - Atomically removes all instances of the objects contained in a List from the array associated with a given key.
-
save(
{bool useMasterKey = false}) → Future< ParseObject> - Saves this object to the server.
-
set(
String key, dynamic value) → void -
Add a key-value pair to this object. It is recommended to name keys in
camelCaseLikeThis
. -
setACL(
ParseACL acl) → void - Setup ParseACL into this object
-
toString(
) → String -
A string representation of this object.
override
-
uploadFiles(
) → Future< void> - Uploading ParseFile's when there is any file to upload
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Properties
-
kExistingCustomObjects
→ Map<
Type, ParseObjectCreator< ParseObject> > -
final
- limitBatchOperations ↔ int
-
getter/setter pair
Static Methods
-
deleteAll(
List< ParseObject> objects, {bool useMasterKey = false}) → Future<void> - Deletes each object in the provided list from the server.
-
registerSubclass(
ParseObjectCreator< ParseObject> creator, [bool replace = false]) → dynamic - Registers a custom subclass type with the Parse SDK, enabling strong-typing of those ParseObjects whenever they appear. Subclasses must specify the className annotation and have a default constructor.
-
saveAll(
List< ParseObject> objects, {bool useMasterKey = false}) → Future<void> - Saves each object in the provided list to the server.