getCampaigns method
Future<Campaigns>
getCampaigns(
- String envId,
- String visitorId,
- String? anonymousId,
- bool hasConsented,
- Map<
String, Object> context,
override
Implementation
@override
Future<Campaigns> getCampaigns(
String envId,
String visitorId,
String? anonymousId,
bool hasConsented,
Map<String, Object> context) async {
// Read File before
String? jsonString = await _readFile().catchError((error) {
Flagship.logger(Level.ALL,
"Error on reading the saved bucketing or the file doesn't exist");
return null;
});
if (jsonString != null) {
Bucketing bucketingObject = Bucketing.fromJson(json.decode(jsonString));
return bucketVariations(
visitorId, bucketingObject, context, assignationHistory ?? {});
} else {
Flagship.logger(Level.ALL, "Flagship, Failed to synchronize");
return Campaigns(visitorId, false, [], null);
}
}