1
votes

i followed this tutorial on youtube https://www.youtube.com/watch?v=LnpGU8vj7TI in order to set firebase with flutter,and after doing exactly as the guy did am having a lot of errors showing in my terminal when I try to run the main.dart file


import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

void main() async{
  WidgetsFlutterBinding().ensureVisualUpdate();
  await Firebase.initializeApp();
  runApp(My_pp());
}

class My_pp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return My_ppstate();
  }
}

class My_ppstate extends State<My_pp> {
  
 
  Widget build(BuildContext context) {
    
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('hello'),
          backgroundColor: Color.fromARGB(50, 255, 255, 5),
        ),
       
            
      ),
    );
  }
}

and the errors are

lib/main.dart: Warning: Interpreting this as package URI, 'package:led_blink/main.dart'. /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui' import 'dart:ui' as ui show Paint, Path, Canvas; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui' import 'dart:ui' show lerpDouble; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Not found: 'dart:ui' import 'dart:ui' as ui; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: Error: Not found: 'dart:ui' import 'dart:ui' show lerpDouble; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui' import 'dart:ui' show lerpDouble; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/bottom_app_bar_theme.dart:5:8: Error: Not found: 'dart:ui' import 'dart:ui' show lerpDouble; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart:5:8: Error: Not found: 'dart:ui' import 'dart:ui' show lerpDouble; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/bottom_sheet.dart:5:8: Error: Not found: 'dart:ui' import 'dart:ui' show lerpDouble; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/bottom_sheet_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble; ^ /D:/flutter_windows_2.0.3-stable/flutter/packages/flutter/lib/src/material/button_bar_theme.dart:5:8: Error: Not found: 'dart:ui' import 'dart:ui' show lerpDouble;

this is the flutter doctor --verbose results: enter image description here the build.gradle from the android folder enter image description here the build.gradle from the app folder enter image description here

1
first try running flutter clean and then add your flutter doctor --verbose results to your question. It's a bit difficult to help with the amount of information you've given, but I'll see what I can do after we get the doctor's results (and possibly a bit more of your code).Eli Front
i added what u requested and am sorry for the late replyDZ UY Scuti
With the information that you've given, I'm going to assume that this is not a problem with your firebase setup. I followed the tutorial and it worked for me, but I am not on windows. Due to the Error: Not found: errors, I am going to assume that the issue lies in the setup of your Flutter project (may want to flutter create again) or in the flutter SDK you have installed. Try reinstalling flutter and/or recreating the project.Eli Front
i reinstalled everything but the problem still the same.. i guess i'll use android studio instead,thank u for ur time anyways!!DZ UY Scuti

1 Answers

0
votes

(answer may not work in future)

(but it work for me now as of writing this answer in April 2021)

i have no idea why its happen but try chaining decencies

android/build.gradle (app level)

    classpath 'com.android.tools.build:gradle:3.5.4' //<---- change this
    classpath 'com.google.gms:google-services:4.3.4'