esms_project/lib/widgets/widget_generate.dart

9 lines
313 B
Dart
Raw Permalink Normal View History

2021-09-02 08:35:25 -03:00
import 'dart:math';
class StringGenerator{
static const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
Random _rnd = Random();
String getRandomString(int length) => String.fromCharCodes(Iterable.generate(
length, (_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length))));
}