title: Flutter GetIt Plugin - No type xxx is registered inside GetIt
body: <p>I set everything up as shown in the example project:</p>
  
  <pre><code>import 'package:get_it/get_it.dart';
  import 'package:places/services/authService.dart';
  
  final locator = GetIt.instance;
  
  void setupLocator() {
    locator.registerSingleton&lt;AuthService&gt;(AuthService());
    print("registered");
  }
  </code></pre>
  
  <p>with the call in the main file</p>
  
  <pre><code>void main() {
    setupLocator();
    runApp(MyApp());
  }
  </code></pre>
  
  <p>I have some Check where the locator also correctly return my AuthService</p>
  
  <pre><code>class AuthGuardView extends StatefulWidget {
    AuthGuardView({Key key}) : super(key: key);
  
    @override
    _AuthGuardViewState createState() =&gt; _AuthGuardViewState();
  }
  
  class _AuthGuardViewState extends State&lt;AuthGuardView&gt; {
    @override
    Widget build(BuildContext context) {
      return ViewModelProvider&lt;AuthGuardViewModel&gt;.withConsumer(
        viewModel: AuthGuardViewModel(),
        onModelReady: (model) =&gt; model.initialise(),
        builder: (context, model, child) =&gt; model.isLoggedIn
            ? Container(
                color: Colors.white,
                child: Text("Logged In"),
              )
            : SignUpView(),
      );
    }
  }
  
  
  class AuthGuardViewModel extends ChangeNotifier {
    AuthService _authService = locator&lt;AuthService&gt;();
    bool isLoggedIn = false;
  
    void initialise() async {
      isLoggedIn = await _authService.isLoggedIn();
      notifyListeners();
    }
  }
  </code></pre>
  
  <p>If I do the exact same thing inside the ViewModel for the SignUpView I get the following error </p>
  
  <pre><code>flutter: The following assertion was thrown building SignUpView(dirty, state: _SignUpViewState#01129):
  flutter: No type AuthService is registered inside GetIt.
  flutter:  Did you forget to pass an instance name?
  flutter: (Did you accidentally do  GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance;did you
  flutter: forget to register it?)
  flutter: 'package:get_it/get_it_impl.dart':
  flutter: Failed assertion: line 248 pos 14: 'instanceFactory != null'
  </code></pre>
  
  <p>In the ViewModel for the AuthGuard I do successfully retrieve the auth service. I also commented out the locator code (because I thought it might be the async call or something like that) but the same error persists. </p>
  
  <p>I am using get_it: ^4.0.1 but the error persists when downgrading to 3.x.x</p>
  
  <p><a href="https://i.stack.imgur.com/dUYy4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dUYy4.png" alt="enter image description here"></a></p>
  
  <p>Here the SignUpViewModel </p>
  
  <pre><code>class SignUpViewModel extends ChangeNotifier {
    SignUpViewModel(){
      if(locator.isRegistered&lt;AuthService&gt;()) {
        AuthService _authService = locator&lt;AuthService&gt;();
      } 
    }
    var textInputFormatter = [
      WhitelistingTextInputFormatter(RegExp(r'\d')),
      PhoneNumberTextInputFormatter()
    ];
    var textEditingController;
    var context;
  }
  </code></pre>