bondStateStream method
Implementation
Stream<BondState> bondStateStream(String address) async* {
// 1. MethodChannel로 초기값 get
final int bondStateCode =
await _methodChannel.invokeMethod('bond_state', {'address': address});
logger.d("bondStateCode: $bondStateCode");
final BondState bondState = BondState.getObj(bondStateCode);
yield bondState;
// 2. EventChannel로 stream get
Stream<BondState> stream = _bondStateChannel
.receiveBroadcastStream({'address': address}).map((event) {
final BondState bondState = BondState.getObj(event);
return bondState;
});
yield* stream;
}