Connect to App Services - Flutter SDK
The App
client is the interface to the Atlas App Services
backend. It provides access to the authentication and Device Sync.
Before You Begin
Access the App Client
Create an AppConfiguration object with your App's App ID as the argument.
Create an App with the
AppConfiguration
you just created. You use thisApp
instance to access App Services features throughout your client application.
final appConfig = AppConfiguration(APP_ID); final app = App(appConfig);
You can create multiple App client instances to connect to multiple Apps. All App client instances that share the same App ID use the same underlying connection.
Important
You Can't Change an App Config After Initializing the App
When you initialize the App client, the configuration is cached internally. Attempting to "close" an App and then re-open it with a changed configuration within the same process has no effect. The client continues to use the cached configuration.
Advanced Configuration
You can add optional arguments to the AppConfiguration
for more granular control
of your App
client. You may want to add things like custom timeouts
for connections or keys for local metadata encryption.
To learn about the available configuration options, refer to the
AppConfiguration reference documentation.
final appConfig = AppConfiguration(APP_ID, defaultRequestTimeout: const Duration(seconds: 120), localAppVersion: '2.0' // ... see reference docs for all available configuration options );
Note
Connect Using Android 7 or Older
The default HTTP client included with the Realm Flutter SDK does not work
for apps running on Android 7 or older. To work around this, you must add
a custom HTTP client to your AppConfiguration
. To learn more,
refer to Connect to App Services Using Android 7 or Older.