title: Flutter - Dependency Injection
body: <p>I am after some best practise tips for developing my Flutter app.</p>
  
  <p>Currently, I have an app with multiple pages and multiple plugins such as network connection, SQLite, Location etc.</p>
  
  <p>Currently, on each page, I am creating a new instance of each plugin I need access to as shown below, and then using the plugin functionality. </p>
  
  <pre><code>final _secureStorage = FlutterSecureStorage();
  final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
  </code></pre>
  
  <p>What I want to achieve: I would like to possibly only create an instance of these classes once, and then be able to access the instance in all pages - something like <code>Dependency Injection</code>.</p>
  
  <p>Currently, I am looking into <code>InheritedWidget</code> widget or the Provider package, however, I am not sure if they do what I am trying to achieve as I don't want to inherit or pass around widgets, I want to inject classes instances.</p>