toOption method
Implementation
Option<SmartDateQueryResult> toOption() {
final DefaultQueryResultMixin self = this;
if (self is TermResult) {
if (self.smartDateQuery.isNotNullOrBlank) {
return Option(
this,
label: self.smartDateQuery!,
icon: GlobalIconResolver.instance
.getIconOrNull(this.icon!)
?.toPrefixIcon(),
subtitle: [self.formattedDate],
selection: self.formattedDate,
);
} else {
return Option(
this,
label: self.formattedDate!,
icon: GlobalIconResolver.instance
.getIconOrNull(this.icon!)
?.toPrefixIcon(),
selection: self.formattedDate,
);
}
} else {
final title = this.title ?? formattedDate;
return Option(
this,
label: this.title ?? smartDateQuery ?? "",
icon: GlobalIconResolver.instance
.getIconOrNull(this.icon!)
?.toPrefixIcon(),
subtitle: this.formattedDate.toStringList(),
selection: title,
);
}
}