bhoominn / nb_utils

Collection of Widgets and helpful Methods that every developer needs.
https://pub.dev/packages/nb_utils
MIT License
146 stars 48 forks source link

LateInitializationError: Field 'sharedPreferences' has not been initialized. #45

Open rameshboyee-sayukth opened 1 year ago

rameshboyee-sayukth commented 1 year ago

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field 'sharedPreferences' has not been initialized.

bhoominn commented 1 year ago

Hi, you have to add one line to initialize shared preferences.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await initialize();

  runApp(MyApp());
}