SDK Integration

Learn how to integrate our SDK in your existing app

Currently we support the following platforms for integration

Platform
Support

Flutter

Android

Coming Soon

iOS

Coming Soon

Web

Coming Soon

Flutter

Run

$ flutter pub add digia_ui

or

Update your pubspec.yaml with

dependencies:
  digia_ui: ^0.1.6

If you want to build your entire app with Digia, you should use DUIApp (as below), but if you only want to insert a page from Digia in your app, refer this.

In your main.dart call the DUIApp constructor like below.

  DUIApp(
      digiaAccessKey: "your_project_id",
      flavorInfo: Staging(),
      environment: 'development',
      baseUrl: 'https://app.digia.tech/api/v1',
      networkConfiguration: NetworkConfiguration(
        defaultHeaders: {},
        timeout: 30,
      ),
    );

This will initialize the SDK. Lets understand each of the params

digiaAccessKey

type : string

required : true

This is your Project ID that you can get from Digia Studio.

baseUrl

type : string

required : false

default : https://app.digia.tech/api/v1

The default api url which the SDK will hit to fetch UI data. If you are using a self hosted version of our dashboard use that url.

environment

type : String

'local', 'development', 'production'

required : true

Represents the backend environment the app connects to:

Local: For local development

Development: For development server

Production: For production server

flavorInfo

type : enum FlavorInfo

debug, staging, release, version

required : true

Controls how the app loads and manages configurations:

Debug: Debug will always pull the latest config changes that are made on the dashboard. Use this when you are developing or testing your flows.

Staging: Staging will pull the latest config from the staging environment.

Release: Release takes 3 parameters, InitPriority, appConfig path, and functionsPath.

InitPriority refers to the strategy when app launches:

  1. PrioritizeNetwork: It takes an integer, timeout which sets API timeout value in seconds. This strategy first tries to fetch the config and functions from network. If network fails, it builds appConfig from cache. If cache fails, it builds appConfig from burned assets. If no burned assets, then throws error.

  2. PrioritizeCache This strategy prioritizes appConfig from Cache, and upon failure tries to build appConfig from burned assets.

  3. PrioritizeLocal This strategy prioritizes appConfig from burned assets only.

Version: Version will take a numeric value for a specific version, and fetches the appConfig for that version number.

developerConfig

type : DeveloperConfig

required : false

default : null

Use this during development to enable proxy. Takes an object of DeveloperConfig class requiring two params

proxyUrl: string

A string value in the format of ip:port if you want to use proxies like Proxyman or Charles.

networkConfiguration

type : NetworkConfiguration

required : true

This class holds all the network configuration required for your apis.

defaultHeaders: Map <String, dynamic>

Set the headers you want to send in all API calls that you've configured on the dashboard like Auth, x-device-id etc.

Any headers that are set in the API call on the dashboard are appended to these default headers. If a header is present in both defaultHeaders and API headers, its value will be picked from defaultHeaders.

timeout: int

Set API timeout value in seconds.

To learn how to insert a single page from Digia Studio, refer here:

Last updated