GraphsyncConfig.fromJson constructor

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

Creates a GraphsyncConfig from a JSON map.

Implementation

factory GraphsyncConfig.fromJson(Map<String, dynamic> json) {
  return GraphsyncConfig(
    // ignore: deprecated_member_use_from_same_package
    enabled: json['enabled'] as bool? ?? true,
    defaultMaxDepth: json['defaultMaxDepth'] as int? ?? 32,
    defaultMaxBlocks: json['defaultMaxBlocks'] as int? ?? 1024,
    defaultMaxBytes: json['defaultMaxBytes'] as int? ?? _defaultMaxBytes,
    maxServeDepth: json['maxServeDepth'] as int? ?? 32,
    maxServeBlocks: json['maxServeBlocks'] as int? ?? 10000,
    maxServeBytes: json['maxServeBytes'] as int? ?? _defaultMaxServeBytes,
    fallBackToBitswap: json['fallBackToBitswap'] as bool? ?? true,
  );
}