linter and lint fixes

This commit is contained in:
2024-05-25 21:36:05 +02:00
parent 7e347a70c2
commit 72be45feb4
15 changed files with 256 additions and 158 deletions

View File

@@ -13,10 +13,10 @@ class APIError {
factory APIError.fromJson(Map<String, dynamic> json) {
return APIError(
success: json['success'],
error: json['error'],
errhighlight: json['errhighlight'],
message: json['message'],
success: json['success'] as String,
error: json['error'] as String,
errhighlight: json['errhighlight'] as String,
message: json['message'] as String,
);
}
}

View File

@@ -25,15 +25,15 @@ class Channel {
factory Channel.fromJson(Map<String, dynamic> json) {
return Channel(
channelID: json['channel_id'],
ownerUserID: json['owner_user_id'],
internalName: json['internal_name'],
displayName: json['display_name'],
descriptionName: json['description_name'],
subscribeKey: json['subscribe_key'],
timestampCreated: json['timestamp_created'],
timestampLastSent: json['timestamp_lastsent'],
messagesSent: json['messages_sent'],
channelID: json['channel_id'] as String,
ownerUserID: json['owner_user_id'] as String,
internalName: json['internal_name'] as String,
displayName: json['display_name'] as String,
descriptionName: json['description_name'] as String?,
subscribeKey: json['subscribe_key'] as String?,
timestampCreated: json['timestamp_created'] as String,
timestampLastSent: json['timestamp_lastsent'] as String?,
messagesSent: json['messages_sent'] as int,
);
}
}
@@ -56,20 +56,20 @@ class ChannelWithSubscription extends Channel {
factory ChannelWithSubscription.fromJson(Map<String, dynamic> json) {
return ChannelWithSubscription(
channelID: json['channel_id'],
ownerUserID: json['owner_user_id'],
internalName: json['internal_name'],
displayName: json['display_name'],
descriptionName: json['description_name'],
subscribeKey: json['subscribe_key'],
timestampCreated: json['timestamp_created'],
timestampLastSent: json['timestamp_lastsent'],
messagesSent: json['messages_sent'],
subscription: Subscription.fromJson(json['subscription']),
channelID: json['channel_id'] as String,
ownerUserID: json['owner_user_id'] as String,
internalName: json['internal_name'] as String,
displayName: json['display_name'] as String,
descriptionName: json['description_name'] as String?,
subscribeKey: json['subscribe_key'] as String?,
timestampCreated: json['timestamp_created'] as String,
timestampLastSent: json['timestamp_lastsent'] as String?,
messagesSent: json['messages_sent'] as int,
subscription: Subscription.fromJson(json['subscription'] as Map<String, dynamic>),
);
}
static List<ChannelWithSubscription> fromJsonArray(List<dynamic> jsonArr) {
return jsonArr.map<ChannelWithSubscription>((e) => ChannelWithSubscription.fromJson(e)).toList();
return jsonArr.map<ChannelWithSubscription>((e) => ChannelWithSubscription.fromJson(e as Map<String, dynamic>)).toList();
}
}

View File

@@ -31,26 +31,26 @@ class Message {
factory Message.fromJson(Map<String, dynamic> json) {
return Message(
messageID: json['message_id'],
senderUserID: json['sender_user_id'],
channelInternalName: json['channel_internal_name'],
channelID: json['channel_id'],
senderName: json['sender_name'],
senderIP: json['sender_ip'],
timestamp: json['timestamp'],
title: json['title'],
content: json['content'],
priority: json['priority'],
userMessageID: json['usr_message_id'],
usedKeyID: json['used_key_id'],
trimmed: json['trimmed'],
messageID: json['message_id'] as String,
senderUserID: json['sender_user_id'] as String,
channelInternalName: json['channel_internal_name'] as String,
channelID: json['channel_id'] as String,
senderName: json['sender_name'] as String,
senderIP: json['sender_ip'] as String,
timestamp: json['timestamp'] as String,
title: json['title'] as String,
content: json['content'] as String,
priority: json['priority'] as int,
userMessageID: json['usr_message_id'] as String,
usedKeyID: json['used_key_id'] as String,
trimmed: json['trimmed'] as bool,
);
}
static fromPaginatedJsonArray(Map<String, dynamic> data, String keyMessages, String keyToken) {
static (String, List<Message>) fromPaginatedJsonArray(Map<String, dynamic> data, String keyMessages, String keyToken) {
final npt = data[keyToken] as String;
final messages = (data[keyMessages] as List<dynamic>).map<Message>((e) => Message.fromJson(e)).toList();
final messages = (data[keyMessages] as List<dynamic>).map<Message>((e) => Message.fromJson(e as Map<String, dynamic>)).toList();
return (npt, messages);
}

View File

@@ -19,13 +19,13 @@ class Subscription {
factory Subscription.fromJson(Map<String, dynamic> json) {
return Subscription(
subscriptionID: json['subscription_id'],
subscriberUserID: json['subscriber_user_id'],
channelOwnerUserID: json['channel_owner_user_id'],
channelID: json['channel_id'],
channelInternalName: json['channel_internal_name'],
timestampCreated: json['timestamp_created'],
confirmed: json['confirmed'],
subscriptionID: json['subscription_id'] as String,
subscriberUserID: json['subscriber_user_id'] as String,
channelOwnerUserID: json['channel_owner_user_id'] as String,
channelID: json['channel_id'] as String,
channelInternalName: json['channel_internal_name'] as String,
timestampCreated: json['timestamp_created'] as String,
confirmed: json['confirmed'] as bool,
);
}
}

View File

@@ -41,24 +41,24 @@ class User {
factory User.fromJson(Map<String, dynamic> json) {
return User(
userID: json['user_id'],
username: json['username'],
timestampCreated: json['timestamp_created'],
timestampLastRead: json['timestamp_lastread'],
timestampLastSent: json['timestamp_lastsent'],
messagesSent: json['messages_sent'],
quotaUsed: json['quota_used'],
quotaRemaining: json['quota_remaining'],
quotaPerDay: json['quota_max'],
isPro: json['is_pro'],
defaultChannel: json['default_channel'],
maxBodySize: json['max_body_size'],
maxTitleLength: json['max_title_length'],
defaultPriority: json['default_priority'],
maxChannelNameLength: json['max_channel_name_length'],
maxChannelDescriptionLength: json['max_channel_description_length'],
maxSenderNameLength: json['max_sender_name_length'],
maxUserMessageIDLength: json['max_user_message_id_length'],
userID: json['user_id'] as String,
username: json['username'] as String?,
timestampCreated: json['timestamp_created'] as String,
timestampLastRead: json['timestamp_lastread'] as String?,
timestampLastSent: json['timestamp_lastsent'] as String?,
messagesSent: json['messages_sent'] as int,
quotaUsed: json['quota_used'] as int,
quotaRemaining: json['quota_remaining'] as int,
quotaPerDay: json['quota_max'] as int,
isPro: json['is_pro'] as bool,
defaultChannel: json['default_channel'] as String,
maxBodySize: json['max_body_size'] as int,
maxTitleLength: json['max_title_length'] as int,
defaultPriority: json['default_priority'] as int,
maxChannelNameLength: json['max_channel_name_length'] as int,
maxChannelDescriptionLength: json['max_channel_description_length'] as int,
maxSenderNameLength: json['max_sender_name_length'] as int,
maxUserMessageIDLength: json['max_user_message_id_length'] as int,
);
}
}