BridgeTypeRef.fromJson constructor

BridgeTypeRef.fromJson(
  1. Map<String, dynamic> json
)

Load a type ref from its JSON representation.

Implementation

factory BridgeTypeRef.fromJson(Map<String, dynamic> json) {
  final id = json['id'];
  final ta = [
    for (final arg in json['typeArgs']) BridgeTypeRef.fromJson(arg)
  ];
  if (id != null) {
    return BridgeTypeRef.type(id, ta);
  }
  final gft = json['gft'];
  if (gft != null) {
    return BridgeTypeRef.genericFunction(gft);
  }
  final unresolved = json['unresolved'];
  if (unresolved != null) {
    return BridgeTypeRef(BridgeTypeSpec.fromJson(json['unresolved']), ta);
  }
  return BridgeTypeRef.ref(json['ref'], ta);
}