Code Monkey home page Code Monkey logo

Comments (5)

Lyokone avatar Lyokone commented on August 22, 2024

Hello, are you reproducing this issue using the latest versions?

from flutterfire.

DavidAriza avatar DavidAriza commented on August 22, 2024

Hello, I havent tried the latest versions, I can not upgrade Flutter due to some packages, so I can not upgrade Firebase

from flutterfire.

DavidAriza avatar DavidAriza commented on August 22, 2024

Hi @Lyokone, now I have tried with flutter 3.22.0, and firebase_core 3.1.0 (latest version), and its still the same result.

I did flutter clean, flutter pub get, flutter create --platforms web ., flutterfire configure, even changed Firebase project and registered a new web app, but nothing works. Am I missing something?

This is the dart file

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:test_web/firebase_options.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(options: DefaultFirebaseOptions.web);
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() async {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

This is the output error where changed the version of firebase js as expected

FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app).
https://www.gstatic.com/firebasejs/10.11.1/firebase-app.js 2220:29 getApp

[√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Versi¢n 10.0.19045.4529], locale es-CO)
• Flutter version 3.22.0 on channel stable at C:\Users\57305\fvm\versions\3.22.0
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5dcb86f68f (6 weeks ago), 2024-05-09 07:39:20 -0500
• Engine revision f6344b75dc
• Dart version 3.4.0
• DevTools version 2.34.3

from flutterfire.

Lyokone avatar Lyokone commented on August 22, 2024

Let me see if I can reproduce using a Windows machine

from flutterfire.

Lyokone avatar Lyokone commented on August 22, 2024

@DavidAriza No issue on my side using your example. At this point I'm just assuming a bad development environment. Not sure if it's updating Chrome or corrupted Flutter installation. But initializing Web on Windows or any other platform is working fine;

from flutterfire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.