Open JestrabikR opened 5 months ago
Hi @JestrabikR - do you mind providing a full reproduction code repository demonstrating this issue so I can check, please?
Hello @russellwheatley, thank you. I was able to reproduce it with this code. This issue was discovered on Android device, haven't tested it on iOS yet.
To reproduce, you do the same as described above:
main.dart:
return MaterialApp(
//... another params- not relevant to this example
routes: {
'/testPage': (context) {
return const TestPage();
},
'/profile': (context) {
return ProfileScreen(
providers: providers,
children: [
ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/testPage');
},
child: const Text("Test page"),
),
],
);
},
}
)
test_page.dart:
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
class TestPage extends StatefulWidget {
const TestPage({super.key});
@override
State<TestPage> createState() => _TestPageState();
}
class _TestPageState extends State<TestPage> {
XFile? pickedImage;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: ElevatedButton(
onPressed: () async {
ImagePicker imagePicker = ImagePicker();
pickedImage = await imagePicker.pickImage(source: ImageSource.gallery);
setState(() {}); // reload to display image
},
child: const Text("Choose image")
),
);
}
}
Hi @JestrabikR - I have a tentative fix for your issue. Do you mind trying out that branch and letting me know if it fixes your issue?
Here is the PR with relevant branch: https://github.com/firebase/FirebaseUI-Flutter/pull/419
@JestrabikR - I couldn't get your example repro to work so it would be great if you could confirm
Is there an existing issue for this?
What plugin is this bug for?
Firebase UI Auth
What platform(s) does this bug affect?
Android
List of dependencies used.
flutter pub deps -s list
Steps to reproduce
I can reproduce this bug in my app when I:
Expected Behavior
If I pick the image without closing the widget on profile screen, image is display without an error
Actual Behavior
If I close the widget on profile screen and then try to pick image, error is thrown after the
setState(() { });
Additional Information
Error output: