Block.fromJson constructor

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

Creates an instance of this class from the constructor parameters defined in the json object.

Example

class Item extends Serializable {
  const(this.name, this.count);
  final String name;
  final int? count;
}

final Item x = Item.fromJson({
  'name': 'apple',
  'count': 10,
});

Implementation

factory Block.fromJson(final Map<String, dynamic> json) => Block(
      blockhash: json['blockhash'],
      previousBlockhash: json['previousBlockhash'],
      parentSlot: json['parentSlot'],
      transactions: IterableSerializable.tryFromJson(
          json['transactions'], TransactionData.parse),
      signatures: json['signatures']?.cast<String>(),
      rewards:
          IterableSerializable.fromJson(json['rewards'], Reward.fromJson),
      blockTime: json['blockTime'],
      blockHeight: json['blockHeight'],
    );