
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

You will need to get the document or thing manually first time

As you would have done without realtime

As @D5 said, you need to fetch the user account details via account.get()
to show initial data.
Realtime event is only fired when a data on the observing channel changes. It doesn't do a fetch on connect.

Thank you @darShan & @D5 Will try that. Was expecting to work like firebase

[SOLVED] Realtime API and stream builder
Recommended threads
- "Memberships privacy" setting in 1.7.4
Hi everyone, I'm experiencing an issue with a clean self-hosted installation of Appwrite version 1.7.4. I previously used version 1.6.1, and if I remember corre...
- Function 404 error - Deployment with the...
I have a function in my Appwrite Cloud (free plan) project that cannot be accessed or deleted (404 in both UI and CLI). I'm stuck at the 5 functions limit and c...
- 1.6 to 1.7 does not work
Appwrite (self-hosted) stopped working after updating from 1.6.2 that was stable. Getting the general_server_error. Mentioning I fallowed all steps for upgrad...
