In this example, we will show you how to make basic configurations for the mobile editor. The example is based on the Design Editor
, however, it is exactly the same for all the other solutions.
Configuration
The openEditor
function allows for some further basic configuration of the editor.
EditorConfiguration
All the basic configuration settings are part of the EditorConfiguration
which is required to initialize the editor.
final settings = EditorSettings( license: "YOUR_LICENSE", sceneBaseUri: "YOUR_SCENE_BASE_URI", assetBaseUri: "YOUR_ASSET_BASE_URI", userId: "YOUR_USER_ID" );
license
- the license to activate the Engine with.
license: "YOUR_LICENSE",
sceneBaseURL
- is used to initialize the engine’sbasePath
setting before the editor’sonCreate
callback is run. It is the foundational URL for constructing absolute paths from relative ones. This URL enables the loading of specific scenes or assets using their relative paths.
sceneBaseUri: "YOUR_SCENE_BASE_URI",
assetBaseURL
- is used to initialize the default assets for the asset library.
assetBaseUri: "YOUR_ASSET_BASE_URI",
userID
- an optional unique ID tied to your application’s user. This helps us accurately calculate monthly active users (MAU). Especially useful when one person uses the app on multiple devices with a sign-in feature, ensuring they’re counted once. Providing this aids in better data accuracy. The default value isnil
.
userId: "YOUR_USER_ID"
EditorPreset
preset
- is used to determine which predefined editor variant you want to use - if any.
preset: EditorPreset.design,
Metadata
metadata
- can be used to provide any customMap<String, dynamic>
to the underlying native plugin which you can use for further custom handling.
metadata: {"MY_KEY": "MY_VALUE"}
Full Code
Here’s the full code:
import "package:imgly_editor/imgly_editor.dart";
class BasicEditorSolution { /// Opens the editor. void openEditor() async { final settings = EditorSettings( license: "YOUR_LICENSE", sceneBaseUri: "YOUR_SCENE_BASE_URI", assetBaseUri: "YOUR_ASSET_BASE_URI", userId: "YOUR_USER_ID" );
final _ = await IMGLYEditor.openEditor( preset: EditorPreset.design, settings: settings, metadata: {"MY_KEY": "MY_VALUE"} ); }}