getSegments static method
Gets the segments that the profile belongs to asynchronously.
Segments are groups of users with similar characteristics or behaviors. Note: You must register a pageview first to retrieve and update segments.
Returns a Future<List<dynamic>> containing the user's segments
Implementation
static Future<List<BlueConicSegment>> getSegments() {
final Completer<List<BlueConicSegment>> completer =
Completer<List<BlueConicSegment>>();
BlueConicPlatform.instance.getSegments().then((result) {
if (result.success) {
final List<BlueConicSegment> segments = (result.data as List)
.map((e) => BlueConicSegment.fromMap(e))
.toList();
completer.complete(segments);
} else {
completer.completeError(Exception(result.error ?? 'Unknown error'));
}
});
return completer.future;
}