Admost.initialize constructor

Admost.initialize({
  1. required String appId,
  2. String? userConsent,
  3. String? subjectToGDPR,
  4. String? subjectToCCPA,
})

Implementation

Admost.initialize(
    {required String appId,
    String? userConsent,
    String? subjectToGDPR,
    String? subjectToCCPA}) {
  MethodChannel _channel = const MethodChannel('admost_flutter');
  if (appId == null) {
    print("appId cannot be null!");
  } else {
    this.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;
    }

    _channel.invokeMethod('initialize', config);
  }
}