communities/core/community_utils library

Functions

convertMimeTypes(File file, String? mimeType) String
Overrides mime types
enrichRoom({required Room room, required String roomID, required bool invite}) Room
Enriches a single room object with the group name, avatar URL, and invite status
enrichRooms(Map<String, Room>? roomsData, {bool invite = false}) Map<String, Room>?
Processes the initial room data after the sync API is called the first time
fibonacci(int n) List<int>
formatMessageTimestamp(int? timestamp) String
Returns a human readable format of a Matrix timestamp
formatTimestamp({required int? timestamp, bool showTime = true, bool showDate = true}) String
Formats a timestamp
formatUsername(String? name) String
Truncates the unnecessary parts of a username
getInitials(String string) String
Retrieves a name's initials
processMembership({required MembershipEventTypes? type, required String sender, required String target}) String
Returns a human-readable string representation of membership events.
processRoomUpdates({required Room serverRoom, required Room stateRoom, required bool invite}) Room
Cleans up room updates by removing duplicate events and redacted events
selectPhoto({required ImagePicker picker}) Future<File?>
sortEvents(List<Message?>? events) List<Message?>
sortRoomsByLastActivity(List<Room> rooms) List<Room>
updateRoomData({required Map<String, Room>? fromServer, required Map<String, Room>? fromState, required bool invite}) Map<String, Room>?
Loops through the new events from Matrix and runs updates on the old events