For the complete documentation index, see llms.txt. This page is also available as Markdown.

Advanced Integration

This guide covers advanced SDK features for customization and extension in both Flutter and Android.

1. Custom Widgets

Register your own native widgets to use them within Digia Studio. This is useful for maps, camera views, or complex native components.

Step 1: Define Props Class

class MyWidgetProps {
  final String title;
  MyWidgetProps({required this.title});
  
  static MyWidgetProps fromJson(Map<String, dynamic> json) {
    return MyWidgetProps(title: json['title']);
  }
}

Step 2: Register Widget

DUIFactory().registerWidget<MyWidgetProps>(
  'custom/myWidget', // ID used in Digia Studio
  MyWidgetProps.fromJson,
  (props, childGroups) => MyCustomWidget(title: props.title),
);

Step 1: Register Widget

DUIFactory.getInstance().registerWidget("custom/map") { props, registry ->
    // Extract props safely
    val lat = props["latitude"] as? Double ?: 0.0
    val lng = props["longitude"] as? Double ?: 0.0
    
    // Return your Composable
    GoogleMap(
        cameraPositionState = rememberCameraPositionState {
            position = CameraPosition.fromLatLngZoom(LatLng(lat, lng), 10f)
        }
    )
}

2. Environment Variables

Pass runtime configuration (like API endpoints, feature flags, or user tokens) to your Digia pages. Access them in Digia Studio using ${env.variableName}.

Option A: At Initialization

Option B: Runtime Update

Runtime Update You can set environment variables at any time after initialization:


3. Analytics Integration

Track user interactions from Digia UI pages by implementing the Analytics interface.

Step 1: Implement Adapter

Step 2: Initialize

Step 1: Implement Interface

Step 2: Pass to Options

Last updated