title: Have multiple types for one argument for a generic class in Dart
body: <p>I want to have a custom class where I can pass the type of my generic argument</p>
  <p>Is it possible to do this or I have to use the dynamic type ?</p>
  <p>Is there a equivalent to this : <code>Team|Site item;</code></p>
  <p>Or I need to use this : <code>dynamic item;</code></p>
  <pre class="lang-dart prettyprint-override"><code>class Site {
    String name;
    int levels;
  
    Site({
      required this.name,
      required this.levels,
    });
  }
  
  class Team {
    String name;
    String description;
  
    Team({
      required this.name,
      required this.description,
    });
  }
  
  
  class CustomItem {
    // Related line
    Team|Site item;
    
    CustomItem({
      required this.item,
    });
    
    getName() {
      print(item.name);
    }
    
  }
  
  void main() {
    final team = Team(name: 'dev', description: 'a team of dev');
    final site = Site(name: 'paris', levels: 6);
    final customTeam = CustomItem(item: team);
    final customSite = CustomItem(item: site);
    customTeam.getName();
    customSite.getName();
  }
  </code></pre>