import 'dart:convert';
// import 'dart:io';
import 'dart:math';
void main() {
// stdout.write("How strong a password do you want? Weak, Medium or Strong: ");
// String choice = stdin.readLineSync().toLowerCase();
String choice = "Weak".toLowerCase();
// String choice = "Medium".toLowerCase();
// String choice = "Strong".toLowerCase();
passwordGenerator(choice);
}
// Create a random sequence of characters
void shuffleGenerator(int strength) {
final random = Random.secure();
print('random:\t$random');
List<int> intList = List.generate(strength, (_) => random.nextInt(255));
print('intList:\t$intList');
print('intList Length:\t${intList.length}');
List charList = base64UrlEncode(intList).split('').toList();
print('base64UrlEncode(intList):\t${base64UrlEncode(intList)}');
print('charList:\t$charList');
print('charList Length:\t${charList.length}');
charList.shuffle();
print("\nYour password is: ${charList.join('')}\n");
}
void passwordGenerator(String strength) {
if (strength == "weak") {
// shuffleGenerator(5);
shuffleGenerator(0);
shuffleGenerator(1);
shuffleGenerator(2);
shuffleGenerator(3);
shuffleGenerator(4);
shuffleGenerator(5);
} else if (strength == "medium") {
shuffleGenerator(15);
} else if (strength == "strong") {
shuffleGenerator(25);
} else {
print("Incorrect word is given");
}
}