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
- Impossible to get USER after createEmail...
Am using provider to deal with functions linked to appwrite. Here is my login. Future<String?> login(String email, String password) async { try { aw...
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...