hasSegment static method

Future<bool> hasSegment(
  1. String segmentId
)

Checks whether the BlueConic profile belongs to a specific segment asynchronously.

This method returns true if the profile is part of the specified segment, false otherwise. Segments group users with similar characteristics.

segmentId The ID of the segment to check membership for Returns a Future<bool> indicating segment membership

Implementation

static Future<bool> hasSegment(String segmentId) {
  final Completer<bool> completer = Completer<bool>();
  BlueConicPlatform.instance.hasSegment(segmentId).then((result) {
    if (result.success) {
      completer.complete(result.data as bool);
    } else {
      completer.completeError(Exception(result.error ?? 'Unknown error'));
    }
  });
  return completer.future;
}