Check platform in flutter either it is ANDROID or IOS?

Widget _getPlatformQrView() {
  Widget _platformQrView;  switch (defaultTargetPlatform) {
    case TargetPlatform.android:
      _platformQrView = AndroidView(
        viewType: 'net.touchcapture.qr.flutterqr/qrview',        onPlatformViewCreated: _onPlatformViewCreated,      );      break;    case TargetPlatform.iOS:
      _platformQrView = UiKitView(
        viewType: 'net.touchcapture.qr.flutterqr/qrview',        onPlatformViewCreated: _onPlatformViewCreated,        creationParams: _CreationParams.fromWidget(0, 0).toMap(),        creationParamsCodec: StandardMessageCodec(),      );      break;    default:
      throw UnsupportedError(
          "Trying to use the default webview implementation for $defaultTargetPlatform but there isn't a default one");  }
  return _platformQrView;}

Comments