BrowserServerOptionsOrCDPLaunchOptions.fromJson constructor

BrowserServerOptionsOrCDPLaunchOptions.fromJson(
  1. dynamic json
)

Implementation

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