Flutter web throws error on same project but different laptop


So I just won a new laptop in a competition and now I am having some trouble migrating my flutter projects. I have set up the editor and migrated the important files in the code, i.e the lib, image, font, pubspec.yaml and web. But this app is now throwing the following error

Launching lib\main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
ERROR - 2020-12-29 13:08:07.845202
GET /main_module.bootstrap.js
Error thrown by handler.
AbsoluteImportUriError: 'file:///C:/FlutterProjects/xspectre/lib/help/Auth.dart'
package:dwds/src/debugging/metadata/provider.dart 154:9   MetadataProvider._addMetadata
package:dwds/src/debugging/metadata/provider.dart 133:15  MetadataProvider._initialize.<fn>

I thought it may be a problem with my flutter but it runs the default flutter app without problem.
I also tried deleting the file but the problem just shifts to another file. I can safely say that this a is a problem with the help folder which provides me essential tools such as the auth service. What should I do? I will provide any code neccesary. You can find the entire code here


The Error:

The error is happening because when importing your new project, some imports in your .dart files are now using absolute paths instead of relative paths. In your case, this is happening at least in one .dart file that is calling your Auth.dart.


Step 1: Look at the top of all your .dart files, more precisely at every single import. You will have to change everything starting with:

import 'file:///C:/...


import 'package:... and add the name of your app

Step 2: Rerun your project and everything should work now

If still issues, then make sure you looked at all your files to ensure you did not miss other wrong import… also, you can run flutter clean then run a Pub Get

(thanks to melwinlobo18)

Please mark the answer if this was useful ;0)

Answered By – Canada2000

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *