getProfileValues static method
Gets all values of a specified profile property asynchronously.
Some profile properties can have multiple values. This method retrieves all values for the specified property as a list of strings.
property The name of the profile property to retrieve values for
Returns a Future<List<String>?> containing all property values, or null if none exist
Implementation
static Future<List<String>?> getProfileValues(String property) {
final Completer<List<String>?> completer = Completer<List<String>?>();
BlueConicPlatform.instance.getProfileValues(property).then((result) {
if (result.success) {
final data = result.data;
if (data == null) {
completer.complete(null);
} else {
try {
final List<String> converted = (data as List)
.map((e) => e.toString())
.toList();
completer.complete(converted);
} catch (e) {
completer.completeError(
Exception('Failed to convert profile values: $e'),
);
}
}
} else {
completer.completeError(Exception(result.error ?? 'Unknown error'));
}
});
return completer.future;
}