title: Passing Class to Function
body: <p>I’d like to pass the class <code>User</code> as second argument to the <code>load</code>-function.</p>
  <p>Maybe someone knows how?</p>
  <pre><code>class App {
    Map&lt;String, List&lt;Model&gt;&gt; models = {
      'users': List&lt;User&gt;()
    };
  
    App() {
      load('users');
    }
  
    void load(resource) {
      Directory directory = Directory.fromUri(Uri(path: './app/data/' + resource));
      for (FileSystemEntity file in directory.listSync(recursive: false)) {
        Map&lt;String, dynamic&gt; fileContent = jsonDecode(File(file.uri.path).readAsStringSync());
        models[resource].add(User.fromJson(fileContent));
      }
    }
  }
  </code></pre>