submitMessage function

Future<void> submitMessage(
  1. {required String channelId,
  2. required String text}
)

Implementation

Future<void> submitMessage(
        {required String channelId, required String text}) async =>
    await FirebaseFirestore.instance
        .collection("channels/${channelId}/messages")
        .add({
      "message": text,
      "date": DateTime.now().millisecondsSinceEpoch,
      "author": locate<AuthenticationState>().username,
      "profilePhoto": locate<AuthenticationState>().photoUrl,
      "uid": locate<AuthenticationState>().userId
    });