How to get number's length in Dart?
How could I get the length of a number in Dart? Is there an equivalent to the one used in strings?
For ex: 1050000 has a length of 7. How could I dynamically discover this?
You can try this.
int i = 1050000;
int length = i.toString().length; // 7
// or
int length = '$i'.length; // 7
With this extension method you would be able to use the length method on any number.
extension Num on num {
int length() => this.toString().length;
}