Created
March 16, 2020 23:45
-
-
Save mohammedsalem97/7ded18ff7c648c8a950803b32ce2246e to your computer and use it in GitHub Desktop.
Random ID Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///This file is a random id generator function | |
///consists of 10 random alphabetics and numbers | |
///copyrights 2020 reserved for [Mohammed Salem] | |
/// * Flutter Developer and UI Designer | |
import 'dart:math'; | |
void main() { | |
var id = ''; | |
for (int count = 0; count <= 10; count++) { | |
var randomIndex = Random().nextInt(alphabetics.length - 1); | |
id = "$id${alphabetics[randomIndex]}"; | |
} | |
print("Id : $id"); | |
} | |
List<dynamic> alphabetics = [ | |
0, | |
1, | |
2, | |
3, | |
4, | |
5, | |
6, | |
7, | |
8, | |
9, | |
'a', | |
'A', | |
'b', | |
'B', | |
'c', | |
'C', | |
'd', | |
'D', | |
'e', | |
'E', | |
'f', | |
'F', | |
'g', | |
'G', | |
'h', | |
'H', | |
'i', | |
'I', | |
'j', | |
'J', | |
'k', | |
'K', | |
'l', | |
'L', | |
'm', | |
'M', | |
'n', | |
'N', | |
'o', | |
'O', | |
'p', | |
'P', | |
'q', | |
'Q', | |
'r', | |
'R', | |
's', | |
'S', | |
't', | |
'T', | |
'u', | |
'U', | |
'v', | |
'V', | |
'w', | |
'W', | |
'x', | |
'X', | |
'y', | |
'Y', | |
'z', | |
'Z', | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment