title: Lazy Singleton vs Singleton in Dart
body: <p>I'm using the <a href="https://pub.dev/packages/get_it" rel="noreferrer">get_it</a> package and you get two options for registering Singletons, lazy and I guess "regular" (<code>GetIt.instance.registerLazySingleton</code> and <code>GetIt.instance.registerSingleton</code> respectively) Here's one of the classes that's registered as a plain Singleton:</p>
  
  <pre><code>class AndroidDetails {
    static final DeviceInfoPlugin _deviceInfoPlugin = DeviceInfoPlugin();
    Map&lt;String, dynamic&gt; _deviceData = {};
  
    AndroidDetails() {
      _init().then((_) =&gt; getIt.signalReady(this));
    }
  
    Future&lt;void&gt; _init() async {
      try {
        AndroidDeviceInfo _deviceInfo = await deviceInfoPlugin.androidInfo;
        _deviceData = _getDeviceData(_deviceInfo);
      } on PlatformException {
        _deviceData = &lt;String, dynamic&gt;{
          'Error:': 'Failed to get platform version.',
        };
      }
    }
  
    Map&lt;String, dynamic&gt; _getDeviceData(AndroidDeviceInfo build) {
      return &lt;String, dynamic&gt;{
        'version.sdkInt': build.version.sdkInt,
      };
    }
  
    bool canChangeStatusBarColor() {
      if (_deviceData.isNotEmpty) {
        return _deviceData['version.sdkInt'] &gt;= 21;
      }
      return null;
    }
  
    bool canChangeNavbarIconColor() {
      if (_deviceData.isNotEmpty) {
        return _deviceData['version.sdkInt'] &gt;= 27;
      }
      return null;
    }
  }
  </code></pre>
  
  <p>How it's registered:</p>
  
  <pre><code>// main.dart
  getIt.registerSingleton&lt;AndroidDetails&gt;(AndroidDetails(), signalsReady: true);
  </code></pre>
  
  <p>My question is, what's the difference between a "normal" Singleton and a Lazy Singleton in Dart &amp; the get_it package?</p>