Created
April 29, 2022 14:53
-
-
Save Bharathh-Raj/6b58f5ef0b4d8561054b21e07d8b2f57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
Wallet btc = BTCWallet(BTCWalletDC("", 0)); | |
btc.derive(); | |
btc.walletDC.balance; | |
} | |
// @freezed | |
// class WalletDC with _$WalletDC { | |
// const factory WalletDC.eth(String phrase, double balance) = ETHWalletDC; | |
// const factory WalletDC.btc(String phrase, double balance) = BTCWalletDC; | |
// } | |
// DC - Data Class | |
abstract class WalletDC { | |
final String? phrase; | |
final double balance; | |
WalletDC(this.phrase, this.balance); | |
} | |
class ETHWalletDC extends WalletDC { | |
ETHWalletDC(String? phrase, double balance) : super(phrase, balance); | |
} | |
class BTCWalletDC extends WalletDC { | |
BTCWalletDC(String? phrase, double balance) : super(phrase, balance); | |
} | |
abstract class Wallet { | |
WalletDC walletDC; | |
Wallet(this.walletDC); | |
derive(); | |
send(); | |
loadBalance(); | |
} | |
class ETHWallet extends Wallet { | |
ETHWalletDC ethWalletDC; | |
ETHWallet(this.ethWalletDC) : super(ethWalletDC); | |
@override | |
derive() {} | |
@override | |
loadBalance() {} | |
@override | |
send() {} | |
} | |
class BTCWallet extends Wallet { | |
BTCWalletDC btcWalletDC; | |
BTCWallet(this.btcWalletDC) : super(btcWalletDC); | |
@override | |
derive() {} | |
@override | |
loadBalance() {} | |
@override | |
send() {} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment