Skip to main content

Flutter Journey Service

Functions

syncJourneys

Future<void> syncJourneys()

Synchronizes the journey list with the Orchestrator.

Parameters: None.

getJourneys

Future<List<Journey>> getJourneys({
List<String> tags = const [],
List<JourneyStatus> statuses = const [JourneyStatus.notStarted],
bool onlyInAudience = false,
})

Retrieves journeys from local storage, optionally filtered by tags, status, and audience membership.

Parameters:

  • tags: List — Optional journey tags to filter by. Empty list disables tag filtering.
  • statuses: List — Optional journey status filters. Defaults to [JourneyStatus.notStarted].
  • onlyInAudience: bool — If true, returns only journeys where the current user is in the target audience. Defaults to false.

getJourney

Future<Journey?> getJourney(String name)

Retrieves a single journey by its name from local storage. Returns null if the journey is not found.

Parameters:

  • name: String — Name of the journey.

runJourney

Future<Map<String, dynamic>> runJourney(
String name,
Map<String, dynamic>? data
)

Executes the specified journey experience and returns its output as JSON.

Parameters:

  • name: String — Name of the journey to run.
  • data: Map? — Optional input payload for initializing the journey context.

getJourneyExecutionRecords

Future<List<JourneyExecutionRecord>?> getJourneyExecutionRecords(
String name
)

Retrieves all execution records for the specified journey.

Parameters:

  • name: String — Name of the journey.

getLastJourneyExecutionRecord

Future<JourneyExecutionRecord?> getLastJourneyExecutionRecord(
String name
)

Retrieves the latest execution record for the specified journey, if any.

Parameters:

  • name: String — Name of the journey.

getJourneyStatus

Future<JourneyStatus> getJourneyStatus(String name)

Returns the current status of the specified journey.

Parameters:

  • name: String — Name of the journey.

Classes

Journey

class Journey {
final String id;
final String name;
final JourneyMetadata metadata;
final List<String>? tags;
final double createdAt;
final double? updatedAt;
final double? publishedAt;
}

JourneyMetadata

class JourneyMetadata {
final String title;
final String? description;
final String? imageUrl;
}

JourneyExecutionRecord

class JourneyExecutionRecord {
final String id;
final JourneyStatus status;
final Map<String, dynamic>? journeyContext;
final double date;
}

JourneyStatus

enum JourneyStatus {
notStarted,
completed,
sent,
unknown,
}