Files
fcs/lib/pages/widgets/display_image_source.dart
phyothandar 079c9a135d null safety
2021-09-10 14:25:37 +06:30

31 lines
737 B
Dart

import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/widgets.dart';
class DisplayImageSource {
String? url;
File? file;
DisplayImageSource({this.url, this.file});
ImageProvider? get imageProvider =>
file == null ? CachedNetworkImageProvider(url!) : FileImage(file!);
@override
bool operator ==(other) {
if (identical(this, other)) {
return true;
}
return (other.file == this.file &&
(other.file != null || this.file != null)) ||
(other.url == this.url && (other.url != null || this.url != null));
}
@override
int get hashCode {
int result = 17;
result = 37 * result + file.hashCode;
return result;
}
}