App class Application

An App is the main client-side entry point for interacting with an Atlas App Services application.

The App can be used to

  • Register uses and perform various user-related operations through authentication providers
  • Synchronize data between the local device and a remote Realm App with Synchronized Realms

Constructors

App(AppConfiguration configuration)
Create an app with a particular AppConfiguration. This constructor should only be used on the main isolate and, ideally, only once as soon as the app starts.

Properties

baseUrl Uri
Returns the current value of the base URL used to communicate with the server.
no setter
currentUser User?
Gets the currently logged in User. If none exists, null is returned.
no setter
emailPasswordAuthProvider EmailPasswordAuthProvider
Returns an instance of EmailPasswordAuthProvider
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
The id of this application. This is the same as the appId in the AppConfiguration used to create this App.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
users Iterable<User>
Gets all currently logged in users.
no setter

Methods

deleteUser(User user) Future<void>
Deletes a user and all its data from the device as well as the server.
logIn(Credentials credentials) Future<User>
Logs in a user with the given credentials.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reconnect() → void
Provide a hint to this app's sync client to reconnect. Useful when the device has been offline and then receives a network reachability update.
removeUser(User user) Future<void>
Removes a user and their local data from the device. If the user is logged in, they will be logged out in the process.
switchUser(User user) → void
Switches the currentUser to the one specified in user.
toString() String
A string representation of this object.
inherited
updateBaseUrl(Uri? baseUrl) Future<void>
Temporarily overrides the baseUrl value from AppConfiguration with a new baseUrl value used for communicating with the server. If set to null, the app will revert to the default base url.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getById(String id, {Uri? baseUrl}) App?
Obtain an App instance by id. The app must have first been created by calling the constructor that takes an AppConfiguration on the main isolate. If an App hasn't been already constructed with the same id, will return null. This method is safe to call on a background isolate.