BrowserServerOptionsOrCDPLaunchOptionsOrString.fromJson constructor

BrowserServerOptionsOrCDPLaunchOptionsOrString.fromJson(
  1. dynamic json
)

Implementation

factory BrowserServerOptionsOrCDPLaunchOptionsOrString.fromJson(
  dynamic json,
) {
  if (json == null) {
    throw Exception(
      'Cannot parse null as BrowserServerOptionsOrCDPLaunchOptionsOrString',
    );
  }
  if (json is Map<String, dynamic>) {
    try {
      return BrowserServerOptionsOrCDPLaunchOptionsOrString.fromBrowserServerOptions(
        BrowserServerOptions.fromJson(json),
      );
    } catch (_) {}
  }
  if (json is Map<String, dynamic>) {
    try {
      return BrowserServerOptionsOrCDPLaunchOptionsOrString.fromCDPLaunchOptions(
        CDPLaunchOptions.fromJson(json),
      );
    } catch (_) {}
  }
  if (json is String) {
    return BrowserServerOptionsOrCDPLaunchOptionsOrString.fromString(json);
  }
  throw Exception(
    'Invalid type for BrowserServerOptionsOrCDPLaunchOptionsOrString: ${json.runtimeType}',
  );
}