Move to Flutter 3.47, use the improvements that come with this (#64)

Reviewed-on: #64
This commit is contained in:
Henry Hiles 2026-08-22 13:04:33 -04:00 committed by Henry Hiles
commit 077044ec19
157 changed files with 1366 additions and 1457 deletions

View file

@ -2,43 +2,42 @@ import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:freezed_annotation/freezed_annotation.dart";
import "package:nexus/models/content/content.dart";
import "package:nexus/models/relation_type.dart";
part "send_message.freezed.dart";
part "send_message.g.dart";
@freezed
abstract class SendMessageRequest with _$SendMessageRequest {
const factory SendMessageRequest({
required String roomId,
required String text,
Content? baseContent,
@Default(Mentions()) @JsonKey(name: "mentions") Mentions mentions,
@JsonKey(name: "relates_to") Relation? relation,
}) = _SendMessageRequest;
@Freezed(toJson: false, fromJson: false)
@JsonSerializable()
class const SendMessageRequest({
required final String roomId,
required final String text,
final Content? baseContent,
@JsonKey(name: "mentions") final Mentions mentions = const Mentions(),
@JsonKey(name: "relates_to") final Relation? relation,
}) with _$SendMessageRequest {
Map<String, Object?> toJson() => _$SendMessageRequestToJson(this);
factory SendMessageRequest.fromJson(Map<String, Object?> json) =>
_$SendMessageRequestFromJson(json);
}
@freezed
abstract class Mentions with _$Mentions {
const factory Mentions({
@Default(false) bool room,
@Default(IList.empty()) IList<String> userIds,
}) = _Mentions;
@Freezed(toJson: false, fromJson: false)
@JsonSerializable()
class const Mentions({
final bool room = false,
final IList<String> userIds = const IList.empty(),
}) with _$Mentions {
Map<String, Object?> toJson() => _$MentionsToJson(this);
factory Mentions.fromJson(Map<String, Object?> json) =>
_$MentionsFromJson(json);
}
@Freezed(toJson: false)
abstract class Relation with _$Relation {
const Relation._();
const factory Relation({
required String eventId,
required RelationType relationType,
}) = _Relation;
class const Relation({
required final String eventId,
required final RelationType relationType,
}) with _$Relation {
Map<String, dynamic> toJson() {
switch (relationType) {
case RelationType.reply: