userChanges property
The user, on every sign-in, sign-out and profile change.
Implementation
@override
Stream<AppUser?> get userChanges {
late StreamController<AppUser?> controller;
StreamSubscription<User?>? users;
StreamSubscription<void>? guests;
controller = StreamController(
onListen: () {
users = auth.userChanges().listen((u) => controller.add(_map(u)), onError: controller.addError);
guests = _guestChanges.stream.listen((_) => controller.add(currentUser));
},
onCancel: () async {
await guests?.cancel();
await users?.cancel();
},
);
return controller.stream;
}