title: Flutter unable to get data from GetStorage in top level function
body: <p>I'm tryin to create background task using <a href="https://pub.dev/packages/workmanager" rel="nofollow noreferrer">workmanager</a> package, but when i try to get data form GetStorage, the workresult was success but the getStorage result always null. Here is my top level function code in file <strong>notification-service.dart</strong>:</p>
  <pre><code>void backgroundTask() {
    Workmanager().executeTask((task, inputData) async {
       var userData = await GetStorage().read('userData');
       print(userData);
       await NotificationService().init();
       return Future.value(true);
    });
  } 
  </code></pre>
  <p>and here is my main function in <strong>main.dart</strong> file:</p>
  <pre><code>void main() async {
    WidgetsFlutterBinding.ensureInitialized();
    await GetStorage.init();
    Workmanager().initialize(backgroundTask, isInDebugMode: true);
    await Workmanager().registerPeriodicTask(
      &quot;01&quot;,
      &quot;backgroundTask&quot;,
      frequency: Duration(minutes: 15),
    );
    SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
        .then((_) {
      runApp(App());
    });
  }
  </code></pre>
  <p>here is log from debug console:</p>
  <pre><code>D/EGL_emulation( 7849): eglCreateContext: 0x71c0756c8cc0: maj 3 min 0 rcv 3
  D/EGL_emulation( 7849): eglCreateContext: 0x71c0756c9be0: maj 3 min 0 rcv 3
  D/HostConnection( 7849): HostConnection::get() New Host Connection established 0x71c08565be90, tid 7923
  D/HostConnection( 7849): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
  D/EGL_emulation( 7849): eglMakeCurrent: 0x71c0756c9be0: ver 3 0 (tinfo 0x71c0156d06a0) (first time)
  D/HostConnection( 7849): HostConnection::get() New Host Connection established 0x71c08565a810, tid 7922
  D/HostConnection( 7849): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
  D/EGL_emulation( 7849): eglMakeCurrent: 0x71c0756c8cc0: ver 3 0 (tinfo 0x71c0156e1380) (first time)
  D/EGL_emulation( 7849): eglCreateContext: 0x71c0756ca210: maj 3 min 0 rcv 3
  I/flutter ( 7849): null
  I/WM-WorkerWrapper( 7849): Worker result SUCCESS for Work [ id=d9d93197-a676-4d6c-813a-7884ccf6d05c, tags={ be.tramckrijte.workmanager.BackgroundWorker } ]
  E/libEGL  ( 7849): call to OpenGL ES API with no current context (logged once per thread)
  </code></pre>
  <p>any solution?</p>