title: Flutter get library - Unhandled Exception: NoSuchMethodError: The getter 'overlay' was called on null. E/flutter (29207): Receiver: null
body: <p>I want to show dialogue and Toast message without context as I am calling those from a method that has no context access. I found <a href="https://pub.dev/packages/get" rel="nofollow noreferrer">get</a> library is appropriate. It mentioned that "you can open dialog from anywhere in your code without context", but when I put any simple code from example in my app code, I get errors. Here is my test code:</p>
  
  <pre><code>import 'package:get/get.dart';
  
  void main() {
    runApp(MyApp());
  
    const oneSec = const Duration(milliseconds: 250);
    new Timer.periodic(oneSec, (Timer t) =&gt; check());
  }
  
  void check() {
    if (result == PI) {   //global variables
      //showDialogue();
      //Get.snackbar('Hi', 'i am a modern snackbar');//error
      Get.dialog(SimpleDialog());//error
    }
  }
  
  void showDialogue(){
  }
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The getter 'overlay' was called on null.
  E/flutter (29207): Receiver: null
  E/flutter (29207): Tried calling: overlay
  E/flutter (29207): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
  E/flutter (29207): #1      Get.overlayContext (package:get/src/get_main.dart:907:62)
  E/flutter (29207): #2      Get.dialog (package:get/src/get_main.dart:225:16)
  E/flutter (29207): #3      checkVentilator.&lt;anonymous closure&gt; (package:ventilator/main.dart:82:17)
  E/flutter (29207): #4      _rootRunUnary (dart:async/zone.dart:1192:38)
  .............................
  </code></pre>
  
  <p>FlutterToast library code runs fine here. But I'm always getting somekind of error with <code>Get</code> library code. Even if this <code>Get</code> code executed from onTapp function of a button built as widget. I do not want to use <code>GetMaterialAPP()</code> but will it fix these errors? How can I solve this problem and show simple dialogue or toast?</p>