
David Coba Casas
PreguntaEstimados
Tengo un problema, cuando tomo la foto no se direcciona al screen para completar los datos del place screen(add_place_screen.dart) y cuando se vuelve a ejecutar la operación para tomar una nueva foto se tiene el siguiente error
Exception has occurred.
PlatformException (PlatformException(already_active, Image picker is already active, null))

Francisco Javier Vásquez
Mira todo mi código de button_bar.dart:
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:generic_bloc_provider/generic_bloc_provider.dart'; import 'package:image_picker/image_picker.dart'; import 'package:platzi_trips_app/Place/ui/screens/add_place_screen.dart'; import 'package:platzi_trips_app/User/bloc/bloc_user.dart'; import 'circle_button.dart'; class ButtonsBar extends StatelessWidget { UserBloc userBloc; @override Widget build(BuildContext context) { userBloc = BlocProvider.of(context); return Padding( padding: EdgeInsets.symmetric(horizontal: 0.0, vertical: 10.0), child: Row( children: <Widget>[ CircleButton(true, Icons.vpn_key, 20.0, Color.fromRGBO(255, 255, 255, 0.6), () => {}), CircleButton(false, Icons.add, 40.0, Color.fromRGBO(255, 255, 255, 1), () { getImage(context); retrieveLostData(context); } ), CircleButton(true, Icons.exit_to_app, 20.0, Color.fromRGBO(255, 255, 255, 0.6), () => userBloc.signOut()) ], )); } Future getImage(BuildContext context) async { File image = await ImagePicker.pickImage(source: ImageSource.camera).catchError((onError) => print(onError)); if (image != null) { Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) => AddPlaceScreen(image: image))); } } Future<void> retrieveLostData(BuildContext context) async { final LostDataResponse response = await ImagePicker.retrieveLostData(); if (response == null) return; if (response.file != null) { Navigator.push(context,MaterialPageRoute(builder: (BuildContext context) => AddPlaceScreen(image: response.file))); } } }