As i implemented my own way to put image in hive but it did not work. I searched on internet but not found any sound solution. A complete code to implement it can be helpful. Any help will be appreciated. Thanks!
Code i used to pick image and put it into hive.
File? _image;
Future getAndSaveImage() async {
final image = await ImagePicker().pickImage(source: ImageSource.gallery);
if (image == null) return;
final tempImage = File(image.path);
setState(() {
_image = tempImage;
images.put(_nameController.text, ProfileImage(_image!));
});
}
Hive Model Class
import 'dart:io';
import 'package:hive/hive.dart';
part 'profile_image.g.dart';
@HiveType(typeId: 2)
class ProfileImage {
ProfileImage(this.profileStudentImage);
@HiveField(0)
final File profileStudentImage;
}
Please give a proper working solution i really need it.😢