title: Flutter / Dart Convert Int to Enum
body: <p>Is there a simple way to convert an integer value to enum? I want to retrieve an integer value from shared preference and convert it to an enum type.</p>
  
  <p>My enum is:</p>
  
  <pre><code>enum ThemeColor { red, gree, blue, orange, pink, white, black };
  </code></pre>
  
  <p>I want to easily convert an integer to an enum:</p>
  
  <pre><code>final prefs = await SharedPreferences.getInstance();
  ThemeColor c = ThemeColor.convert(prefs.getInt('theme_color')); // something like that
  </code></pre>