mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
@@ -1,3 +1,5 @@
|
||||
import 'dart:math' show pow;
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
extension ImageExtension on num {
|
||||
@@ -13,3 +15,10 @@ extension IntExt on int? {
|
||||
int? operator +(int other) => this == null ? null : this! + other;
|
||||
int? operator -(int other) => this == null ? null : this! - other;
|
||||
}
|
||||
|
||||
extension DoubleExt on double {
|
||||
double toPrecision(int fractionDigits) {
|
||||
var mod = pow(10, fractionDigits.toDouble()).toDouble();
|
||||
return ((this * mod).round().toDouble() / mod);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user