getMetaThemeColor method Null safety

Future<Color?> getMetaThemeColor()

Returns an instance of Color representing the content value of the <meta name="theme-color" content=""> tag of the current WebView, if available, otherwise null.

NOTE: It is implemented using JavaScript.


Future<Color?> getMetaThemeColor() async {
  var metaTags = await getMetaTags();
  MetaTag? metaTagThemeColor;

  for (var metaTag in metaTags) {
    if ( == "theme-color") {
      metaTagThemeColor = metaTag;

  if (metaTagThemeColor == null) {
    return null;

  var colorValue = metaTagThemeColor.content;

  return colorValue != null
      ? UtilColor.fromStringRepresentation(colorValue)
      : null;