Docs Menu

Docs HomeRealm

Connect to App Services - Flutter SDK

On this page

  • Before You Begin
  • Access the App Client
  • Advanced Configuration

The App client is the interface to the Atlas App Services backend. It provides access to the authentication and Device Sync.

  1. Create an App Services App

  1. Find the App ID in the Realm UI.

  2. Create an AppConfiguration object with your App's App ID as the argument.

  3. Create an App with the AppConfiguration you just created. You use this App 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.

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.

←  Application Services Overview - Flutter SDKAtlas GraphQL API →
Share Feedback
© 2023 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.