CoinEntity.fromJson constructor
CoinEntity.fromJson( - Map json
)
Implementation
factory CoinEntity.fromJson(Map json) {
return switch (json) {
{
'name': String name,
'symbol': String symbol,
'decimals': int decimals,
'chainID': int chainID,
'contractAddress': String contractAddress,
} =>
ERC20Entity(
name: name,
symbol: symbol,
decimals: decimals,
chainID: chainID,
contractAddress: contractAddress,
allowDeletion: json['allowDeletion'] ?? true,
),
{
'name': String name,
'symbol': String symbol,
'decimals': int decimals,
'chainID': int chainID,
} =>
EvmCoinEntity(
name: name,
symbol: symbol,
decimals: decimals,
chainID: chainID,
),
{
'name': String name,
'symbol': String symbol,
'decimals': int decimals,
} =>
CoinEntity(
name: name,
symbol: symbol,
decimals: decimals,
),
_ => throw Exception("Invalid TokenEntity JSON"),
};
}