retrieveLostData static method
Android: recovers a pick result after the activity was destroyed (e.g. low memory).
Call from initState or early in main after WidgetsFlutterBinding.ensureInitialized().
On non-Android platforms this returns an empty LostDataResponse without calling the plugin.
Implementation
static Future<LostDataResponse> retrieveLostData() async {
if (kIsWeb || defaultTargetPlatform != TargetPlatform.android) {
return LostDataResponse.empty();
}
try {
return await ImagePicker().retrieveLostData();
} on PlatformException catch (e) {
debugPrint('retrieveLostData: $e');
return LostDataResponse.empty();
} on UnimplementedError {
return LostDataResponse.empty();
}
}