Event$ object was thrown resolving an image frame: [object Event] - flutter

======== Exception caught by image resource service ================================================
The following Event$ object was thrown resolving an image frame:
[object Event]
When the exception was thrown, this was the stack:
Image provider: NetworkImage("https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.vecteezy.com%2Ffree-vector%2Fprofile-avatar&psig=AOvVaw2GefCTODTxsxVvzrV4lp5z&ust=1674463308057000&source=images&cd=vfe&ved=0CBAQjRxqFwoTCKCf94fk2vwCFQAAAAAdAAAAABAE", scale: 1)
answer for this========

That link does not point to an image, but to a Google redirection page which points to an image-search page. You must provide a single image URL to the NetworkImage instance.

Related

problem with testing Mock api giving me error null is not a subtype of bool

i try to test a mock API
it give me an error (null is not a subtype of bool)enter image description here
enter image description here

Uncaught (in promise) FirebaseError: Expected type 'Zu', but it was: a custom ea object

I'm trying to get data from firestore and show it in the frontend. But I keep getting this error "Uncaught (in promise) FirebaseError: Expected type 'Zu', but it was: a custom ea object"
Code:My code
Error: Error
You need to use getDocs instead of getDoc when querying multiple documents from a collection.

event input dialog flowtter

I want to raise a Dialogflow event from the flutter app using dialog flowtter. There is an exception. 400 field input not set. what can I do?
DetectIntentResponse response = await dialogFlowtter.detectIntent(
queryInput: QueryInput(
eventInput:
EventInput(name:"username",languageCode: "en", parameters:{username: user!.uid})),
audioConfig: OutputAudioConfig(),
);
Unhandled Exception: Exception: INVALID_ARGUMENT: Field input not set., (400)
I found out it was a bug from the dialog flowtter library. it is now changed in version 0.3.2

Access data in runtimeType Response<dynamic> : Dio error

I am sending a request which is erroring with dio library
When catching the error, I can print(e.response); and print(e.response.statusCode);
The runtimeType of the response is Response<dynamic>
And when printing the response I get something like this
{"message":"there is message from the api here"}
I cannot access this message to print it.
I tried
e.response.message and get errors.dart:167 Uncaught (in promise) Error: NoSuchMethodError: 'message'
e.response["message"] and get Uncaught (in promise) Error: NoSuchMethodError: '[]'
I tried json.encoding the e.response, and it doesn't work either, how can I access the data inside the type Response<dynamic>
Thank you
Use e.response.data['...'] instead in order to access the data you want,

uncaught exception of type NSException with AlamoFireImage when url isn't an image

I am using AlamofireImage to display images in a UITableViewCell
typealias boolAndAnyCompletion = (_ success: Bool, _ value: Any?) -> Void
class ImageHelper {
func fetchImage(url:String, completion: #escaping boolAndAnyCompletion) {
Alamofire.request(url).responseImage { response in
if let image = response.result.value {
completion(true, image)
} else {
completion(false, "No image")
}
}
}
}
This is mostly working fine. I am taking a url from a JSON object and attempted to fetch image at the url. Mostly this works fine and either returns image as expected or fails if the url string is 404 or otherwise invalid.
However today I started getting my app crashing with
libc++abi.dylib: terminating with uncaught exception of type NSException
I narrowed this down to the above method where my JSON response was giving me a url in error that was not pointing to an image.
if if the url I got for an image was "https://bbc.co.uk/news/" that that causes the crash. However if I search for an image at "https://www.google.co.uk/maps/" that fails as expected without crashed and dealt with by error handling.
I know that the best solution is for only correct image urls to be put in JSON but were dealing with humans doing that and mistakes may happen. So, Is there a reason one would 'fail correctly' which the other crashed my app? How can I prevent this crash on some invalid urls?
I found the solution to my problem and not surprised I got no answer as the problem wasn't above. I look at previous answer here and set an exception break point.
My app is also using Realm (which didn't seem relevant at first). I was populating UITableViewCell with data from Realm. Then I downloaded JSON and created new objects and deleted old realm ones.
The exception break point then stopped on
#throw RLMException(#"Object has been deleted or invalidated.")
In the cocoapod. As I was saving a string or the url and not the url in realm I'm guessing the cell started download, was then invalidated and assuming thats what caused the crash.