refactor: Update to Dart 3.10 with . shorthands
This commit is contained in:
parent
75a37f3f7c
commit
1ea649f01e
167 changed files with 3351 additions and 3912 deletions
|
|
@ -25,9 +25,7 @@ class BlurHash extends StatefulWidget {
|
|||
class _BlurHashState extends State<BlurHash> {
|
||||
Uint8List? _data;
|
||||
|
||||
static Future<Uint8List> getBlurhashData(
|
||||
BlurhashData blurhashData,
|
||||
) async {
|
||||
static Future<Uint8List> getBlurhashData(BlurhashData blurhashData) async {
|
||||
final blurhash = b.BlurHash.decode(blurhashData.hsh);
|
||||
final img = blurhash.toImage(blurhashData.w, blurhashData.h);
|
||||
return Uint8List.fromList(image.encodePng(img));
|
||||
|
|
@ -46,11 +44,7 @@ class _BlurHashState extends State<BlurHash> {
|
|||
|
||||
return _data ??= await compute(
|
||||
getBlurhashData,
|
||||
BlurhashData(
|
||||
hsh: widget.blurhash,
|
||||
w: width,
|
||||
h: height,
|
||||
),
|
||||
BlurhashData(hsh: widget.blurhash, w: width, h: height),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -84,21 +78,10 @@ class BlurhashData {
|
|||
final int w;
|
||||
final int h;
|
||||
|
||||
const BlurhashData({
|
||||
required this.hsh,
|
||||
required this.w,
|
||||
required this.h,
|
||||
});
|
||||
const BlurhashData({required this.hsh, required this.w, required this.h});
|
||||
|
||||
factory BlurhashData.fromJson(Map<String, dynamic> json) => BlurhashData(
|
||||
hsh: json['hsh'],
|
||||
w: json['w'],
|
||||
h: json['h'],
|
||||
);
|
||||
factory BlurhashData.fromJson(Map<String, dynamic> json) =>
|
||||
BlurhashData(hsh: json['hsh'], w: json['w'], h: json['h']);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'hsh': hsh,
|
||||
'w': w,
|
||||
'h': h,
|
||||
};
|
||||
Map<String, dynamic> toJson() => {'hsh': hsh, 'w': w, 'h': h};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue