title: Parameter specified as non-null is null caused by java.lang.IllegalArgumentException
body: <p>After I take a picture and click <code>checkmark</code> button on camera interface, I get below exception that leads to app crash:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter data
  </code></pre>
  
  <p>This exception occurs only if I try to take a picture, not when I select an image from the gallery.</p>
  
  <p>As the exception states that the <code>data</code> parameter is being passed as <code>null</code> whereas it should be <code>non-null</code> and points to the kotlin file function. After researching on this issue, I came to know that I need to pass <code>?</code> to the said parameter. (Source : <a href="https://snipnyet.com/ojixzzz/5b3ab17077da154922550e92/kotlin-java-lang-illegalargumentexception-parameter-specified/" rel="nofollow noreferrer">this</a> and <a href="https://github.com/firebase/FirebaseUI-Android/issues/782" rel="nofollow noreferrer">this</a>), but now I am getting </p>
  
  <pre><code>Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Intent?
  </code></pre>
  
  <p>I have no experience of working with Kotlin so am not sure if that was the correct fix in my case. I would like to know how to fix this issue if anybody has come across an exception like this.</p>
  
  <p>Code below:</p>
  
  <pre><code>void _checkCameraPermission() {
      PermissionHandler()
          .checkPermissionStatus(PermissionGroup.camera)
          .then((status) {
        if (status == PermissionStatus.granted) {
          getImage(ImageSource.camera);
        } else {
          _askCameraPermission();
        }
      });
    }
  
    void _askCameraPermission() {
      PermissionHandler()
          .requestPermissions([PermissionGroup.camera]).then(_onStatusRequested);
    }
  
    void _onStatusRequested(Map&lt;PermissionGroup, PermissionStatus&gt; value) {
      final status = value[PermissionGroup.camera];
      if (status == PermissionStatus.granted) {
        getImage(ImageSource.camera);
      }
    }
    Future uploadFile(imageFile) async {
  //    String fileName = DateTime.now().millisecondsSinceEpoch.toString();
      String fileName = "images/" + new Uuid().v4() + ".jpg";
      StorageReference reference = FirebaseStorage.instance.ref().child(fileName);
      StorageUploadTask uploadTask = reference.putFile(imageFile);
  
      await uploadTask.onComplete.then((value) {
        reference.getDownloadURL().then((result) {
          // result is the file URL
          if (result != null) {
            setState(() {
              isLoading = false;
            });
            onSendMessage(result, 2);
          }
        });
      });
    }
  </code></pre>
  
  <p>Exception log:</p>
  
  <pre><code>E/AndroidRuntime( 8402): FATAL EXCEPTION: main
  E/AndroidRuntime( 8402): Process: com.quickcarl.qcflutterpro, PID: 8402
  E/AndroidRuntime( 8402): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2343, result=-1, data=null} to activity {com.quickcarl.qcflutterpro/com.quickcarl.qcflutterpro.MainActivity}: **java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter data**
  E/AndroidRuntime( 8402):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3699)
  E/AndroidRuntime( 8402):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
  E/AndroidRuntime( 8402):    at android.app.ActivityThread.-wrap16(ActivityThread.java)
  E/AndroidRuntime( 8402):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
  E/AndroidRuntime( 8402):    at android.os.Handler.dispatchMessage(Handler.java:102)
  E/AndroidRuntime( 8402):    at android.os.Looper.loop(Looper.java:148)
  E/AndroidRuntime( 8402):    at android.app.ActivityThread.main(ActivityThread.java:5417)
  E/AndroidRuntime( 8402):    at java.lang.reflect.Method.invoke(Native Method)
  E/AndroidRuntime( 8402):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  E/AndroidRuntime( 8402):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  E/AndroidRuntime( 8402): Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter data
  E/AndroidRuntime( 8402):    at com.quickcarl.qcflutterpro.MainActivity.onActivityResult(MainActivity.kt)
  E/AndroidRuntime( 8402):    at android.app.Activity.dispatchActivityResult(Activity.java:6428)
  E/AndroidRuntime( 8402):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
  E/AndroidRuntime( 8402):    ... 9 more
  </code></pre>
  
  <p>MainActivity code:</p>
  
  <pre><code>override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
          super.onActivityResult(requestCode, resultCode, data)
  
          if(requestCode == VIDEO_SCREEN_REQUEST_CODE) {
              if(resultCode == Activity.RESULT_OK) {
                  sendStringMessageToFlutter(data.getStringExtra("roomName"), "completeRoom")
              }
          }
      }
  </code></pre>