Created
December 13, 2018 16:08
-
-
Save lifenautjoe/d012dd2e5c24e93b0a16aff7be7280a8 to your computer and use it in GitHub Desktop.
Random Hex Color Dart
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
import 'dart:math'; | |
Random random = new Random(); | |
String generateRandomHexColor(){ | |
int length = 6; | |
String chars = '0123456789ABCDEF'; | |
String hex = '#'; | |
while(length-- > 0) hex += chars[(random.nextInt(16)) | 0]; | |
return hex; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you for your solution. it's useful for me.