Appstent Flutter

Render Appstent CMS documents directly as widgets in your Flutter app. The widget loads a document by path using your Appstent API key.

Installation

Use Flutter 3.44.0 or later and Dart 3.12 or later. From your app, run:

flutter pub add appstent_flutter

Render a document

Configure the SDK at app startup with an Appstent-issued API key.

import 'package:appstent_flutter/appstent_flutter.dart';
import 'package:flutter/material.dart';

void main() {
  AppstentSdk.configure(
    apiKey: const String.fromEnvironment('APPSTENT_API_KEY'),
    contentEnvironment: 'prod',
  );
  runApp(const MaterialApp(
    home: AppstentContentView(contentPath: 'screens/home'),
  ));
}

Supply the key when building or running your app, for example with --dart-define=APPSTENT_API_KEY=<appstent-api-key>. A key included in a client build is visible to that client. Use an Appstent key issued for the app and environment it will access.

Use a document path within the selected environment, with an optional .json suffix. The SDK sends the API key and environment to Appstent for the root document, includes, and document navigation routes. The app supplies the path and the SDK handles the JSON response internally. A browser deployment also needs the content endpoint to allow its origin and Appstent request headers through CORS. Android release builds need the INTERNET permission in the host app manifest.

AppstentContentView accepts optional loadingBuilder and errorBuilder callbacks. The error builder receives an AppstentContentException and a retry callback. To check the configured key and environment ahead of rendering, await AppstentSdk.validateContentEnvironment(). The server authorizes each document request independently.

The SDK automatically loads active design tokens for the selected environment. If there is no active token file, it renders with the default resolver. Pass automaticallyLoadDesignTokens: false to AppstentSdk.configure or provide explicit tokens through AppstentRenderEnvironment when needed.

License

The distributed Flutter SDK is available under BSD-3-Clause. Loading content from Appstent CMS requires an authorized Appstent API key.

Libraries

appstent_flutter