setSdkStateListener method
Set a block to be invoked every time SDK state changes. Important:
- Set this State listener before
initializing
the SDK to anticipate the SDK State changes triggered byinitializing
API.
Returns stream: latest SDK state. Invoked every time SDK state changes.
Implementation
@override
Stream<MoveState> setSdkStateListener() async* {
yield* sdkStateChannel
.receiveBroadcastStream()
.asyncMap<MoveState>((sdkState) {
MoveState? result = MoveState.values.firstWhereOrNull(
(element) => element.name.toLowerCase() == sdkState.toLowerCase());
return result ?? MoveState.unknown;
});
}