jeudi 25 mars 2021

Flutter Firebase random String

Does anyone know how I can put the String _map before the _chars that there is then a map with a random String like this : AllComments.df8dfd or AllComments.erte84 :

AllComments

    df8dfd : "hello"
    erte84 : "cool"
static const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
 String _map = 'AllComments.';
  Random _rnd = Random();

  String getRandomString(int length) => String.fromCharCodes(Iterable.generate(
      length, (_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length))));



Aucun commentaire:

Enregistrer un commentaire