start method

Future<File?> start(
  1. BuildContext context
)

starting camera

Implementation

Future<File?> start(BuildContext context) async {
  try {
    if (Platform.isAndroid) {
      var result = await _methodChannel.invokeMethod("start");
      if ("$result" != "null" && "$result" != "") {
        return File("$result".replaceAll("file:/", ""));
      }
    } else if (Platform.isIOS) {
      var result = await Navigator.push(context,
          MaterialPageRoute(builder: (context) => const CameraPage()));
      if (result != null) {
        return result as File;
      }
    } else {
      return null;
    }
  } catch (e) {
    debugPrint("error: $e");
    return null;
  }
  return null;
}