title: Flutter - Using Custom Hex colours
body: <p>How can you add colours from Hex values in Flutter? For instance, I am trying the following:</p>
  
  <pre><code>Widget build(BuildContext context) {
    return Row(
      children: &lt;Widget&gt;[
        Expanded(
          child: Container(
            padding: EdgeInsets.only(left: 20.0),
            height: 100.0,
            decoration: BoxDecoration(
              color: Color.hex("#183451"),
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              children: &lt;Widget&gt;[
                Image.asset('assets/main_image.png'),
                // More widgets here
              ],
            ),
          ),
        ),
      ],
    );
  }
  </code></pre>
  
  <p>But get the following error:</p>
  
  <blockquote>
    <p>Error: The argument type 'color::Color' can't be assigned to the
    parameter type 'dart.ui::Color</p>
  </blockquote>
  
  <p>This is using the "color" package:
  <a href="https://pub.dartlang.org/packages/color" rel="nofollow noreferrer">https://pub.dartlang.org/packages/color</a></p>
  
  <p>If I use a <code>MaterialColor</code> it will work as anticipated:</p>
  
  <pre><code>color: Colors.blue
  </code></pre>
  
  <p>I guess I would need to create a <code>MaterialColor</code>, however these take an integer value and swatch. Would the Hex Value need to be converted from a string to an int? I guess looking for some code examples how to acheive this, if possible :)</p>
  
  <p>Thanks in advance</p>