flutter_aepedge 5.0.0 copy "flutter_aepedge: ^5.0.0" to clipboard
flutter_aepedge: ^5.0.0 copied to clipboard

Official Adobe Experience Platform support for Flutter apps. The Experience Platform Edge extension enables sending data to the Adobe Experience Edge from a mobile device.

flutter_aepedge #

pub package Build License

flutter_aepedge is a flutter plugin for the iOS and Android Adobe Experience Platform Edge SDK to allow for integration with Flutter applications. Functionality to enable the Edge extension is provided entirely through Dart documented below.

Prerequisites #

The Edge Network extension has the following peer dependencies, which must be installed prior to installing it:

Installation #

Install instructions for this package can be found here.

Note: After you have installed the SDK, don't forget to run pod install in your ios directory to link the libraries to your Xcode project.

Usage #

For more detailed information on the Edge APIs, visit the documentation here

Importing the extension: #

In your Flutter application, import the Edge extension as follows:

import 'package:flutter_aepedge/flutter_aepedge.dart';
copied to clipboard

Initializing with SDK: #

To initialize the SDK, use the following methods:

Refer to the root Readme for more information about the SDK setup.

API reference #

extensionVersion #

Returns the SDK version of the Edge Network extension.

Syntax

static Future<String> get extensionVersion
copied to clipboard

Example

String version = await Edge.extensionVersion;
copied to clipboard

getLocationHint #

Gets the Edge Network location hint used in requests to the Adobe Experience Platform Edge Network. The Edge Network location hint may be used when building the URL for Adobe Experience Platform Edge Network requests to hint at the server cluster to use.

Syntax

static Future<String?> get locationHint
copied to clipboard

Example

String? result = null;

try {
  result = await Edge.locationHint;
} on PlatformException {
  log("Failed to get location hint");
}
copied to clipboard

resetIdentity #

Resets current state of the AEP Edge extension and clears previously cached content related to current identity, if any. See MobileCore.resetIdentities for more details.


setLocationHint #

Sets the Edge Network location hint used in requests to the Adobe Experience Platform Edge Network. Passing null or an empty string clears the existing location hint. Edge Network responses may overwrite the location hint to a new value when necessary to manage network traffic.

Warning: Use caution when setting the location hint. Only use location hints for the "EdgeNetwork" scope. An incorrect location hint value will cause all Edge Network requests to fail with 404 response code.

Syntax

static Future<void> setLocationHint([String? hint])
copied to clipboard

Example

Edge.setLocationHint('va6');
copied to clipboard

sendEvent #

Sends an Experience event to Adobe Experience Platform Edge Network.

Syntax

static Future<List<EventHandle>> sendEvent(
    ExperienceEvent experienceEvent,
  )
copied to clipboard

Example

Map<String, dynamic> xdmData = {"eventType": "SampleEventType"};
Map<String, dynamic> data = {"free": "form", "data": "example"};
final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "data": data
});
List<EventHandle> result = await Edge.sendEvent(experienceEvent);
copied to clipboard

Example with Datastream ID override

Map<String, dynamic> xdmData = {"eventType": "SampleEventType"};
final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "datastreamIdOverride": "SampleDatastreamId"
});
List<EventHandle> result = await Edge.sendEvent(experienceEvent);
copied to clipboard

Example with Datastream config override

Map<String, dynamic> xdmData = {"eventType": "SampleEventType"};
Map<String, dynamic> configOverrides = {
      "com_adobe_experience_platform": {
        "datasets": {
          "event": {
            "datasetId": "sampleDatasetID"
          }
        }
      }
    };
final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "datastreamConfigOverride": configOverrides
});
List<EventHandle> result = await Edge.sendEvent(experienceEvent);
copied to clipboard

Public classes #

ExperienceEvent

Experience event is the event to be sent to Adobe Experience Platform Edge Network. The XDM data is required for any Experience event being sent using the Edge extension.

You can create Experience event either by using dictionaries or by utilizing convenience constructors.

Syntax

//Create Experience event from Dictionary
ExperienceEvent(this.eventData) 

//Create Experience event using convenience constructor
ExperienceEvent.createEventWithOverrides(final Map<String, dynamic> xdmData,
    [final Map<String, dynamic>? data, final String? datastreamIdOverride, final Map<String, dynamic>? datastreamConfigOverride])
 
copied to clipboard

Usage

Create Experience event from Dictionaries:
// Create Experience event with free form data:
final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "data": data
});

// Create Experience event with free form data and datastream ID override:
final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "data": data,
  "datastreamIdOverride": "sampleDatastreamId"
});

// Create Experience event with free form data and datastream config override:
final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "data": data,
  "datastreamConfigOverride": configOverrides
});
copied to clipboard
Create Experience event using convenience constructors:
// Create Experience event with free form data::
final ExperienceEvent experienceEvent =
      ExperienceEvent.createEventWithOverrides(xdmData, data);

// Create Experience event with free form data and datastream ID override:
final ExperienceEvent experienceEvent =
      ExperienceEvent.createEventWithOverrides(xdmData, data, "sampleDatastreamId");

// Create Experience event with free form data and datastream config override:
final ExperienceEvent experienceEvent =
      ExperienceEvent.createEventWithOverrides(xdmData, data, null, configOverrides);


copied to clipboard

Example

Create Experience event using dictionaries

// example 1
// Create Experience Event with freeform data:
Map<String, dynamic> xdmData = {"eventType": "SampleEventType"};
Map<String, dynamic> data = {"free": "form", "data": "example"};
final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "data": data
});
copied to clipboard
// example 2
// Create Experience event with free form data and datastream ID override:
Map<String, dynamic> xdmData = {"eventType": "SampleEventType"};
Map<String, dynamic> data = {"free": "form", "data": "example"};
final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "data": data,
  "datastreamIdOverride": "sampleDatastreamId"
});
copied to clipboard
// example 3
// Create Experience event with free form data and datastream config override:
Map<String, dynamic> xdmData = {"eventType": "SampleEventType"};
Map<String, dynamic> configOverrides = {
    "com_adobe_experience_platform": {
      "datasets": {
        "event": {
          "datasetId": "sampleDatasetID"
        }
      }
    }
  }

final ExperienceEvent experienceEvent = ExperienceEvent({
  "xdmData": xdmData,
  "datastreamConfigOverride": configOverrides
});
copied to clipboard

EventHandle

The EventHandle is a response fragment from Adobe Experience Platform Edge Network for a sent XDM Experience Event. One event can receive none, one or multiple EdgeEventHandle(s) as a response.

static const String _type = 'type';
static const String _payload = 'payload';
copied to clipboard

Next steps - Schemas setup and validation with Assurance #

For examples on XDM schemas and datasets setup and tips on validating with Assurance, refer to the Edge Network tutorial.

Tests #

Run:

flutter test
copied to clipboard

Contributing #

See CONTRIBUTING

License #

See LICENSE

1
likes
140
points
23.3k
downloads

Publisher

verified publisheradobe.com

Weekly Downloads

2024.09.13 - 2025.03.28

Official Adobe Experience Platform support for Flutter apps. The Experience Platform Edge extension enables sending data to the Adobe Experience Edge from a mobile device.

Homepage
Repository (GitHub)
Contributing

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_aepcore, flutter_aepedgeidentity

More

Packages that depend on flutter_aepedge