maybe static method

PassWebService? maybe({
  1. String? authenticationToken,
  2. String? webServiceURL,
})

returns a PassWebService in case authenticationToken and webServiceURL are both valid values.

Implementation

static PassWebService? maybe({
  String? authenticationToken,
  String? webServiceURL,
}) {
  if (authenticationToken == null || webServiceURL == null) return null;
  final uri = Uri.tryParse(webServiceURL);
  if (uri == null || uri.scheme != 'https') return null;
  return PassWebService(
    authenticationToken: authenticationToken,
    webServiceURL: uri,
  );
}