How to resolve the following errors:
- The await expression can only be used in an async function.Try marking the function body with async.
- Instance member 'getImage' can't be accessed using static access.
- The argument type PickedFile can't be assigned to the parameter type File.
//Code Below
import 'package:firebase_ml_vision/firebase_ml_vision.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
void main() async {
runApp(Home());
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
final imageFile = await ImagePicker.getImage(
source: ImageSource.camera,
);
final image = FirebaseVisionImage.fromFile(imageFile);
return Scaffold(
appBar: AppBar(title: Text("Mystify",),),
);
}
}