title: Send image stream byte data flutter to native Android
body: <p>I was trying to process the live camera feed from flutter so I needed to send the byte data to nativve Android for processing.</p>
  <p>I was concatenating the 3 planes as suggested by <a href="https://github.com/FirebaseExtended/flutterfire/blob/8ddab6870ff46b55f212b335eed726d7575cd1d3/packages/firebase_ml_vision/lib/src/firebase_vision.dart#L149" rel="nofollow noreferrer">flutterfire</a>. I needed the data to create an <a href="https://developers.google.com/ml-kit/vision/pose-detection/android#using-a-bytebuffer-or-bytearray" rel="nofollow noreferrer">InputImage</a> for the google ml kit.</p>
  <p>Concatenate Plane method</p>
  <pre><code>static Uint8List _concatenatePlanes(List&lt;Plane&gt; planes) {
      final WriteBuffer allBytes = WriteBuffer();
      for (Plane plane in planes) {
        allBytes.putUint8List(plane.bytes);
      }
      return allBytes.done().buffer.asUint8List();
    }
  </code></pre>
  <p>Input Image created from the image data in native Android</p>
  <pre><code>public void fromByteBuffer(Map&lt;String, Object&gt; imageData, final MethodChannel.Result result) {
    byte[] bytes = (byte[]) imageData.get(&quot;bytes&quot;);
  
    int rotationCompensation = ((int) imageData.get(&quot;rotation&quot;)) % 360;
  
  //Create an input image
    InputImage inputImage = InputImage.fromByteArray(bytes,
                  (int) imageData.get(&quot;width&quot;),
                  (int) imageData.get(&quot;height&quot;),
                   rotationCompensation,
                  InputImage.IMAGE_FORMAT_NV21);
  }
  </code></pre>
  <p>I am not getting any results after processing a frame from camera stream, but if the same frame is captured, stored and then processed by creating the Input Image from file path the image is being processed properly.</p>
  <p>Is there anything wrong in the way I am creating the input image.
  Any help is appreciated.</p>