fromJson static method

ServerWelcome fromJson(
  1. Map<Object?, Object?> json
)

Reads a welcome message; missing fields get safe defaults.

Implementation

static ServerWelcome fromJson(Map<Object?, Object?> json) {
  final protocol = json['protocol'];
  return ServerWelcome(
    protocol: protocol is num ? protocol.toInt() : kProtocolVersion,
    server: json['server']?.toString() ?? 'durbun',
    appId: json['appId']?.toString() ?? '',
    config: SdkConfig.fromJson(json['config']),
    mocks: MockRule.listFromJson(json['mocks']),
  );
}