title: Implement ChangeNotifier vs StateNotifier
body: <p>I'm quite familiar with <a href="https://pub.dev/packages/provider" rel="noreferrer">Provider</a> package and combine it with the <code>ChangeNotifier</code>.</p>
  <p>Let's say I have 3 getters and method with a different function :</p>
  <ol>
  <li>Toggle Loading</li>
  <li>Toggle Image Loading</li>
  <li>Toggle ObsecurePassword</li>
  </ol>
  <h3>Using ChangeNotifer</h3>
  <pre><code>import 'package:flutter/foundation.dart';
  
  class GlobalChangeNotifier extends ChangeNotifier {
    bool _isLoading = false;
    bool _isImageLoading = false;
    bool _isObsecurePassword = false;
  
    bool get isLoading =&gt; _isLoading;
    bool get isImageLoading =&gt; _isImageLoading;
    bool get isObsecurePassword =&gt; _isObsecurePassword;
  
    void setLoading(bool value) {
      _isLoading = value;
      notifyListeners();
    }
  
    void setImageLoading(bool value) {
      _isImageLoading = value;
      notifyListeners();
    }
  
    void setObsecurePassword(bool value) {
      _isObsecurePassword = !value;
      notifyListeners();
    }
  }
  
  final globalChangeNotifier = GlobalChangeNotifier();
  </code></pre>
  <p>If I'm using <code>ChangeNotifier</code>, I only need to create 1 file and just call a method like <code>globalChangeNotifier.METHOD()</code> or value like <code>globalChangeNotifier.value</code>.</p>
  <p>But now, I've learned about <a href="https://pub.dev/packages/riverpod" rel="noreferrer">Riverpod</a> package, and in the documentation, it's using <code>StateNotifier</code>.</p>
  <p>I want to migrate my previous code from <code>ChangeNotifier</code> to <code>StateNotifier</code>.
  But in my understanding, StateNotifier only can hold 1 type data, so if I want to migrate above code I should create 3 files, let's say:</p>
  <ol>
  <li><code>provider_isloading.dart</code>,</li>
  <li><code>provider_isimageloading.dart</code> and</li>
  <li><code>provider_obsecurepassword.dart</code>.</li>
  </ol>
  <h3>Using StateNotifier</h3>
  <pre><code>// provider_isloading.dart
  class IsImageLoading extends StateNotifier&lt;bool&gt; {
    IsImageLoading() : super(false);
  
    void toggleImageLoading(bool value) {
      state = value;
    }
  }
  
  final isImageLoadingProvider = StateNotifierProvider((ref) =&gt; IsImageLoading());
  
  // provider_isimageloading.dart
  
  class IsLoading extends StateNotifier&lt;bool&gt; {
    IsLoading() : super(false);
    void toggleLoading(bool value) =&gt; state = value;
  }
  
  final isLoadingProvider = StateNotifierProvider((ref) =&gt; IsLoading());
  
  // provider_obsecurepassword.dart
  class IsObsecurePassword extends StateNotifier&lt;bool&gt; {
    IsObsecurePassword() : super(false);
  
    void toggleObsecurePassword(bool value) {
      state = !value;
    }
  }
  
  final isObsecurePasswordProvider = StateNotifierProvider((ref) =&gt; IsObsecurePassword());
  </code></pre>
  <p>And I also need to create 1 file to export all of those files:</p>
  <h3>GlobalStateNotifer.dart</h3>
  <pre><code>export './provider_loading.dart';
  export './provider_imageloading.dart';
  export './provider_obsecurepassword.dart';
  </code></pre>
  <p>My question is, is it the best practice to make it as I've explained earlier?</p>
  <h3>My Folder's Structure</h3>
  <p><a href="https://i.stack.imgur.com/7qzik.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7qzik.png" alt="My Folder's Structure" /></a></p>