initialize static method
Implementation
static Future<bool> initialize(
{required String appId,
String? userConsent,
String? subjectToGDPR,
String? subjectToCCPA}) async {
MethodChannel _channel = const MethodChannel('admost_flutter');
if (appId == null) {
print("appId cannot be null!");
return false;
}
_sharedInstance.appId = appId;
Map<String, String> config = {
"appId": appId,
};
if (userConsent != null) {
config["userConsent"] = userConsent;
}
if (subjectToGDPR != null) {
config["subjectToGDPR"] = subjectToGDPR;
}
if (subjectToCCPA != null) {
config["subjectToCCPA"] = subjectToCCPA;
}
try {
final bool? result =
(await _channel.invokeMethod<bool>('initialize', config));
return result ?? false;
} catch (e) {
print("<ADMOST> initialize erorr: ${e}");
return false;
}
}