Hi guys,
I am trying to use realtime API with stream builder. It works but the issue is on the first load it shows nothing. When I change value from the backend it builds the ui.
`/// Account Stream
Stream<RealtimeMessage> userStream() {
final realtime = Realtime(client);
RealtimeSubscription subscription = realtime.subscribe(['account']);
return subscription.stream;
}`
`/// Account Screen
class AccountScreen extends StatefulWidget {
const AccountScreen({super.key});
static const routeName = '/account-screen';
@override
State<AccountScreen> createState() => _AccountScreenState();
}
class _AccountScreenState extends State<AccountScreen> {
final seafarerStream = AppwriteAuthService.instance.userStream();
@override
void initState() {
seafarerStream;
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const EzAppBar(
title: 'Account',
isPage: 'account',
),
body: EzStream(
stream: seafarerStream,
onData: (data) {
final doc = data.payload;
return EzText(
text: doc['name'].toString(),
fontWeight: FontWeight.w700,
);
},
));
}
}
`
How to load data on first load with stream builder....?
Kindly assist. Thank you