BrowserServerOptionsOrString.fromJson constructor

BrowserServerOptionsOrString.fromJson(
  1. dynamic json
)

Implementation

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