Using Edge or Chrome to debug Flutter Applications - flutter

I'm trying to debug my app using edge.
And the first time it run...
It throws me exception saying...
══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
The following ImageCodecException was thrown resolving an image codec:
Failed to load network image.
Image URL: https://i.ytimg.com/vi/eCx7dzYqb98/maxresdefault.jpg
Trying to load an image from another domain? Find answers at:
https://flutter.dev/docs/development/platform-integration/web-images
When the exception was thrown, this was the stack
Image provider: CachedNetworkImageProvider("https://i.ytimg.com/vi/eCx7dzYqb98/maxresdefault.jpg",
scale: 1)
Image key: CachedNetworkImageProvider("https://i.ytimg.com/vi/eCx7dzYqb98/maxresdefault.jpg",
scale: 1):
CachedNetworkImageProvider("https://i.ytimg.com/vi/eCx7dzYqb98/maxresdefault.jpg", scale: 1)
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: ImageCodecException: Failed to load network image.
Another exception was thrown: ImageCodecException: Failed to load network image.
But after I reloaded / restarted app...
Everything is working fine...
What is the reason for this?
When I debug on my mobile phone (I'm using it as emulator) everything is working fine...

Related

The following NetworkImageLoadException was thrown resolving an image codec: HTTP request failed, statusCode: 404

When I call this function the error occurs.
Image.network(
i.toString(),
errorBuilder:((context, error, stackTrace) =>
const Icon(Icons.account_circle)))
If failed to get image, shows icon instead. But the error below is displayed.
════════ Exception caught by image resource service ════════════════════════════
The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 404, https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Google-flutter-logo.svg/2560px-Google-flutter-logo.svg.png
When the exception was thrown, this was the stack
#0 NetworkImage._loadAsync
package:flutter/…/painting/_network_image_io.dart:97
<asynchronous suspension>
Image provider: NetworkImage("https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Google-flutter-logo.svg/2560px-Google-flutter-logo.svg.png", scale: 1.0)
Image key: NetworkImage("https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Google-flutter-logo.svg/2560px-Google-flutter-logo.svg.png", scale: 1.0)
════════════════════════════════════════════════════════════════════════════════
Why this error occurs even I set errorBuilder? I tried other URLs but sometimes this error displayed.
I hope this exception is related to http call made by the widget not related to the error widget builder.
As we can the error states 404 http status code.
If handling the exception is required you can also try cached image package.
below is the link for the package.
Package link: https://pub.dev/packages/cached_network_image

Flutter: How to preserve the file created through getApplicationDocumentsDirectory() on an iPhone?

I made an app for which I store images in a file (using getApplicationDocumentsDirectory()), everything works fine, except on the physical iPhone where I cannot access the data again if I quit the running app.
when I try to reopen the app I get this message error :
Reload already in progress, ignoring request
Restarted application in 1,654ms.
════════ Exception caught by image resource service ════════════════════════════
The following FileSystemException was thrown resolving an image codec:
Cannot open file, path = '/var/mobile/Containers/Data/Application/63108BB4-7170-44CF-8DF6-43885B77C05B/Documents/4TSqff2TFeUnxwQUJXymrZw23ir2.jpg' (OS Error: No such file or directory, errno = 2)
When the exception was thrown, this was the stack
#0 _File.open.<anonymous closure> (dart:io/file_impl.dart:356:9)
<asynchronous suspension>
#1 FileImage._loadAsync
<asynchronous suspension>
Path: /var/mobile/Containers/Data/Application/63108BB4-7170-44CF-8DF6-43885B77C05B/Documents/ImageName1.jpg
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by image resource service ════════════════════════════
Cannot open file, path = '/var/mobile/Containers/Data/Application/63108BB4-7170-44CF-8DF6-43885B77C05B/Documents/WgZMKUy95lOSV9jnlQOE6hbCStS2.jpg' (OS Error: No such file or directory, errno = 2)
════════════════════════════════════════════════════════════════════════════════
In android studio, I don't have this problem!

Android studio flutter logs stacktrace doesn't show correct line number

Android studio for flutter doesn't show correct line number in console.
For e.g.
The following ArgumentError was thrown resolving an image codec:
Invalid argument(s): No host specified in URI file:///
When the exception was thrown, this was the stack:
#0 _HttpClient._openUrl (dart:_http/http_impl.dart:2667:9)
#1 _HttpClient.getUrl (dart:_http/http_impl.dart:2575:48)
#2 NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:87:59)
#3 NetworkImage.load (package:flutter/src/painting/_network_image_io.dart:50:14)
And now have NetworkImage widget all over the code. How to figure out which line is causing this ?

The following ProviderNotFoundException was thrown building Consumer<ThemeProvider>(dirty)

Error: Could not find the correct Provider above this Consumer Widget
EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK
The following TestFailure object was thrown running a test:
Expected: exactly one matching node in the widget tree
Actual: _TextFinder:<zero widgets with text "0" (ignoring offstage widgets)>
Which: means none were found but one was expected
When the exception was thrown, this was the stack:
#4 main.<anonymous closure> (file:///C:/flutter/MyProject/dumpit/test/widget_test.dart:19:5)
(elided one frame from package:stack_trace)
This was caught by the test expectation on the following line:
file:///C:/flutter/MyProject/dumpit/test/widget_test.dart line 19
The test description was:
Counter increments smoke test
There was default test case file present in test folder which was against my app model and hence threw an error. I got rid of it to solve my test run

Exception caught by image resource service The following assertion was thrown resolving an image codec:

════════ Exception caught by image resource service ════════════════════════════
The following assertion was thrown resolving an image codec:
Unable to load asset: /data/user/0/com.Freedom.new_chat/cache/file_picker/-vimzzn.jpg
When the exception was thrown, this was the stack
#0 PlatformAssetBundle.load
package:flutter/…/services/asset_bundle.dart:228
<asynchronous suspension>
#1 AssetBundleImageProvider._loadAsync
package:flutter/…/painting/image_provider.dart:675
<asynchronous suspension>
Anyone can help me i can provide the codes
i would provide them now but i dont know which one have the error and thanks
now i get this one too
Image provider: AssetImage(bundle: null, name: "/data/user/0/com.Freedom.new_chat/cache/file_picker/Snapchat-1984491257.jpg")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#534c4(), name: "/data/user/0/com.Freedom.new_chat/cache/file_picker/Snapchat-1984491257.jpg", scale: 1.0)
close your emulator and run this command
flutter clean
then run this command
flutter pub get
Run Your App