What error?
thanks again brother
I will shwo you
@override Future<User?> getCurrentAccount() async { try { return await _account.get(); } on AppwriteException catch (e, stackTrace) { return null; } catch (e, stackTrace) { return null; } }
this shoudl be the code
@override
Future<User?> getCurrentAccount() async {
try {
return await _account.get();
} on AppwriteException catch (e, stackTrace) {
print(e);
print(st);
return null;
} catch (e, stackTrace) {
print(e);
print(st);
return null;
}
}
but I wrote this ,,,
@override FutureEither<User?> getCurrentAccount() async { try { User? user = await _account.get(); return right(user); } on AppwriteException catch (e, stackTrace) { return left( Failure(e.message ?? 'Some unexpected error occured!', stackTrace)); } catch (e, stackTrace) { return left(Failure(e.toString(), stackTrace)); } }
how do you do that?
Use three ticks
Then the word dart
Like so
const a = 2;
let me try
this is a lien
aah thanks
Yes it's cool You can use many languages
As for your use case What are the messages
} on AppwriteException catch (e, stackTrace) {
return left(
Failure(e.message ?? 'Some unexpected error occured!', stackTrace));
} catch (e, stackTrace) {
return left(Failure(e.toString(), stackTrace));
}
hi
mine was working already at that time
there is no error
Hi, @Binyamin
I am stuck in a situation where I dont understand what shoudl I do to implement a realtime texting system
could you help me understand the flow?
Implementing a Realtime texting with Appwrite is pretty easy. this is a rough project plan example.
Collections.
You'll need to few collections
- Rooms = Id for each room, each room can be assigend to a given Team role.
- Messages = Messages that have
UserID
&RoomID
Realtime
You'll need to subscribe to the Message collection, for example, where app
is the database ID and messages
is the collections ID:
final realtime = Realtime(client);
final subscription = realtime.subscribe(['databases.app.collections.messages.documents']);
subscription.stream.listen((response) {
if(response.events.contains('databases.app.collections.messages.documents.*.create')) {
// Parse the Document payload
}
});
This subscription
will create a continuous stream that will send all the new documents, But only those the current user is allow to see.
Then you can just add those message to the view / local DB.
Check these links:
- Realtime - https://appwrite.io/docs/realtime
- Teams - https://appwrite.io/docs/client/teams
- Events - https://appwrite.io/docs/events
thankyou
Recommended threads
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...