getLivePreview method Null safety

void getLivePreview(
  1. {int frames = 5,
  2. dynamic frameDelay = 34,
  3. required StreamController controller}
)

initiate connection to camera and get the stream this is different for Z1/V and SC2

Implementation

static void getLivePreview(
    {int frames = 5,
    frameDelay = 34,
    required StreamController controller}) async {
  Map<String, dynamic> additionalHeaders = {
    'Accept': 'multipart/x-mixed-replace'
  };

  var response = await command('getLivePreview',
      responseType: ResponseType.stream,
      additionalHeaders: additionalHeaders);

  Stream dataStream = response.data.stream;
  if (!keepRunning) {
    keepRunning = true;

    getFrames(
        dataStream: dataStream,
        frames: frames,
        frameDelay: frameDelay,
        controller: controller);
  } else {
    // close http connection
  }
}