# startLocalPreview method Null safety

Future<void> startLocalPreview(

1. bool frontCamera,
2. int? viewId

)

Enable the preview image of local video

When the first camera video frame starts to be rendered, you will receive the `onFirstVideoFrame(null)` callback in `TRTCCloudListener`.

Parameters:

frontCamera true: front camera; false: rear camera.

viewId `viewId` generated by `TRTCCloudVideoView`

## Implementation

    Future<void> startLocalPreview(bool frontCamera, int? viewId) {
      if (viewId == null) {
        return _channel
            .invokeMethod('startLocalPreview', {"isFront": frontCamera});
      } else {
        return TRTCCloudVideoViewController(viewId)
            .startLocalPreview(frontCamera);
      }
    }