title: java integer color to flutter color and back
body: <p>I'm rebuilding my app from java to flutter. I'm using firebase to store colors as integer values. In java I can use the following to convert rgb values to integer values:</p>
  
  <pre><code>colorInt = (255 &lt;&lt; 24) | (color.red &lt;&lt; 16) | (color.green &lt;&lt; 8) | color.blue;
  </code></pre>
  
  <p>And I can use the following to convert from an integer value to rgb:</p>
  
  <pre><code>int r = (colorInt &gt;&gt; 16) &amp; 0xFF;
  int g = (colorInt &gt;&gt; 8) &amp; 0xFF;
  int b = colorInt &amp; 0xFF;
  </code></pre>
  
  <p>How can I convert a Java integercolor to a flutter color and back?</p>
  
  <p>An example, lets take RGB 154, 255, 147</p>
  
  <p>In flutter this would be the result is 4288348051</p>
  
  <pre><code>(255 &lt;&lt; 24) | (154 &lt;&lt; 16) | (255 &lt;&lt; 8) | 147;
  (4278190080) | (10092544) | (65280) | 147;
  
  (4278190080) | (10092544) = 4288282624;
  (4278190080) | (10092544) | (65280) = 4288347904;
  (4278190080) | (10092544) | (65280) | 147 = 4288348051
  </code></pre>
  
  <p>In java this would be -6619245</p>
  
  <pre><code>(255 &lt;&lt; 24) | (154 &lt;&lt; 16) | (255 &lt;&lt; 8) | 147;
  (-16777216) | (10092544) | (65280) | 147;
  
  (-16777216) | (10092544) = -6684672;
  (-16777216) | (10092544) | (65280) = -6619392;
  (-16777216) | (10092544) | (65280) | 147 = -6619245;
  </code></pre>