added null safety for llc

This commit is contained in:
Deven Joshi
2021-04-08 15:03:16 +05:30
parent 3a5308a9c0
commit c80fc0a6b4
41 changed files with 1222 additions and 1202 deletions
@@ -13,10 +13,10 @@ part 'attachment.g.dart';
class Attachment {
/// Constructor used for json serialization
Attachment({
String id,
String? id,
this.type,
this.titleLink,
String title,
String? title,
this.thumbUrl,
this.text,
this.pretext,
@@ -34,10 +34,10 @@ class Attachment {
this.actions,
this.extraData,
this.file,
UploadState uploadState,
UploadState? uploadState,
}) : id = id ?? const Uuid().v4(),
title = title ?? file?.name,
localUri = file?.path != null ? Uri.parse(file.path) : null {
localUri = file?.path != null ? Uri.parse(file!.path!) : null {
this.uploadState = uploadState ??
((assetUrl != null || imageUrl != null)
? const UploadState.success()
@@ -47,68 +47,68 @@ class Attachment {
/// Create a new instance from a json
factory Attachment.fromJson(Map<String, dynamic> json) =>
_$AttachmentFromJson(
Serialization.moveToExtraDataFromRoot(json, topLevelFields));
Serialization.moveToExtraDataFromRoot(json, topLevelFields)!);
/// Create a new instance from a db data
factory Attachment.fromData(Map<String, dynamic> json) =>
_$AttachmentFromJson(Serialization.moveToExtraDataFromRoot(
json, topLevelFields + dbSpecificTopLevelFields));
json, topLevelFields + dbSpecificTopLevelFields)!);
///The attachment type based on the URL resource. This can be: audio,
///image or video
final String type;
final String? type;
///The link to which the attachment message points to.
final String titleLink;
final String? titleLink;
/// The attachment title
final String title;
final String? title;
/// The URL to the attached file thumbnail. You can use this to represent the
/// attached link.
final String thumbUrl;
final String? thumbUrl;
/// The attachment text. It will be displayed in the channel next to the
/// original message.
final String text;
final String? text;
/// Optional text that appears above the attachment block
final String pretext;
final String? pretext;
/// The original URL that was used to scrape this attachment.
final String ogScrapeUrl;
final String? ogScrapeUrl;
/// The URL to the attached image. This is present for URL pointing to an
/// image article (eg. Unsplash)
final String imageUrl;
final String footerIcon;
final String footer;
final String? imageUrl;
final String? footerIcon;
final String? footer;
final dynamic fields;
final String fallback;
final String color;
final String? fallback;
final String? color;
/// The name of the author.
final String authorName;
final String authorLink;
final String authorIcon;
final String? authorName;
final String? authorLink;
final String? authorIcon;
/// The URL to the audio, video or image related to the URL.
final String assetUrl;
final String? assetUrl;
/// Actions from a command
final List<Action> actions;
final List<Action>? actions;
final Uri localUri;
final Uri? localUri;
/// The file present inside this attachment.
final AttachmentFile file;
final AttachmentFile? file;
/// The current upload state of the attachment
UploadState uploadState;
UploadState? uploadState;
/// Map of custom channel extraData
@JsonKey(includeIfNull: false)
final Map<String, dynamic> extraData;
final Map<String, dynamic>? extraData;
/// The attachment ID.
///
@@ -156,28 +156,28 @@ class Attachment {
_$AttachmentToJson(this), topLevelFields + dbSpecificTopLevelFields);
Attachment copyWith({
String id,
String type,
String titleLink,
String title,
String thumbUrl,
String text,
String pretext,
String ogScrapeUrl,
String imageUrl,
String footerIcon,
String footer,
String? id,
String? type,
String? titleLink,
String? title,
String? thumbUrl,
String? text,
String? pretext,
String? ogScrapeUrl,
String? imageUrl,
String? footerIcon,
String? footer,
dynamic fields,
String fallback,
String color,
String authorName,
String authorLink,
String authorIcon,
String assetUrl,
List<Action> actions,
AttachmentFile file,
UploadState uploadState,
Map<String, dynamic> extraData,
String? fallback,
String? color,
String? authorName,
String? authorLink,
String? authorIcon,
String? assetUrl,
List<Action>? actions,
AttachmentFile? file,
UploadState? uploadState,
Map<String, dynamic>? extraData,
}) =>
Attachment(
id: id ?? this.id,