initialize method Null safety

void initialize(
  1. {String? appId,
  2. String? token,
  3. String? baseUrl,
  4. int? uploadSizeLimit,
  5. Map<String, String>? headers}
)

Implementation

void initialize({
  String? appId,
  String? token,
  String? baseUrl,
  int? uploadSizeLimit,
  Map<String, String>? headers,
}) {
  if (appId != null) this.appId = appId;
  if (token != null) this.token = token;
  if (baseUrl != null) this.baseUrl = baseUrl;
  if (uploadSizeLimit != null) this.uploadSizeLimit = uploadSizeLimit;
  if (headers != null) this.headers = headers;

  client
    ..appId = appId ?? this.appId
    ..token = token ?? this.token
    ..baseUrl = baseUrl ?? this.baseUrl
    ..headers = headers ?? this.headers;
}