2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 10:15:32 +00:00

Display non-field errors as returned from the server

This commit is contained in:
Oliver
2021-10-03 01:20:37 +10:00
parent b7f9f1c55f
commit 2886f7c930
4 changed files with 87 additions and 20 deletions

13
lib/helpers.dart Normal file
View File

@ -0,0 +1,13 @@
/*
* A set of helper functions to reduce boilerplate code
*/
/*
* Simplify a numerical value into a string,
* supressing trailing zeroes
*/
String simpleNumberString(double number) {
// Ref: https://stackoverflow.com/questions/55152175/how-to-remove-trailing-zeros-using-dart
return number.toStringAsFixed(number.truncateToDouble() == number ? 0 : 1);
}