Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

dart string to color

Color fromHex(String hexString) {
    final buffer = StringBuffer();
    if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
    buffer.write(hexString.replaceFirst('#', ''));
    return Color(int.parse(buffer.toString(), radix: 16));
}
fromHex("#ff0000");
 
PREVIOUS NEXT
Tagged: #dart #string #color
ADD COMMENT
Topic
Name
8+1 =