Madhavam Shahi
Madhavam Shahi

Reputation: 1192

Flutter build error.(related to pub-cache)

When I tried to build my project, I get this error printed in my console.

everything was working fine 2 days ago.

Here is the error,

Running "flutter pub get" in SampleApp...
Launching lib\main.dart on Android SDK built for x86 in debug mode...
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
       ^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js.dart:8:1: Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util'
export 'dart:js_util';
^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
                         ^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
                                           ^^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

* Where:
Script 'E:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 896

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'E:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 13s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

I really don't know why is this is happening, i tried googling but couldn't find anything useful.

There are more errors, related to .pub-cache, but i didn't post it, as then the question would be too long.

Please help.

Upvotes: 0

Views: 2574

Answers (2)

Shashi
Shashi

Reputation: 100

To be specific on what needs to be done to help others who are seeing this issue , I am explaining it below :

When you somehow add below import statement, you are likely to see this issue :

import 'package:firebase/firebase.dart';

Find and remove above line, clean your build (by running flutter clean command) and run again. Issue should be resolved by now.

Upvotes: 0

Madhavam Shahi
Madhavam Shahi

Reputation: 1192

The error is in the "Firebase" package, remove that, and it's working.

Upvotes: 1

Related Questions