Skip to content

Instantly share code, notes, and snippets.

@Bharathh-Raj
Created April 29, 2022 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bharathh-Raj/6b58f5ef0b4d8561054b21e07d8b2f57 to your computer and use it in GitHub Desktop.
Save Bharathh-Raj/6b58f5ef0b4d8561054b21e07d8b2f57 to your computer and use it in GitHub Desktop.
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