firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.66k stars 3.96k forks source link

🐛 [PLUGIN_NAME_HERE] Your issue title here #12402

Closed hatyar closed 7 months ago

hatyar commented 7 months ago

Bug report

When I try to use any firebase code from my app I get the following 🥇

./../../AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker_flutter_testing-2.0.3/lib/src/testing_for_testing/test_case.dart:95:56: Error: The getter 'notGCed' isn't defined for the class 'IgnoredLeaks'.
 - 'IgnoredLeaks' is from 'package:leak_tracker/src/leak_tracking/primitives/model.dart' ('../../../AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-10.0.3/lib/src/leak_tracking/primitives/model.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'notGCed'.
      ignore: settings.ignore || settings.ignoredLeaks.notGCed.ignoreAll,
                                                       ^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker_testing-2.0.3/lib/src/leak_testing.dart:146:9: Error: No named parameter with the name 'notGCed'.

Steps to reproduce

Steps to reproduce the behavior:

run a simple flutter program that tries to initialize the firebase app:

here is my source code:

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

void main() {
  runApp(MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
       primarySwatch: Colors.blue,
      ),
      home: const HomePage(),
    ),
  );
}

class HomePage extends StatefulWidget {
  const HomePage({ super.key });

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  late final TextEditingController _email;
  late final TextEditingController _password; 

  @override
  void initState() {
    _email = TextEditingController();
    _password = TextEditingController();
    super.initState();
  }

  @override
  void dispose() {
    _email.dispose();
    _password.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Register'),
        backgroundColor: Colors.lightBlue,
        primary: true,
      ),
      body: Column(
        children: [
          TextField(
            controller: _email,
            autocorrect: false,
            enableSuggestions: false,
            keyboardType: TextInputType.emailAddress,
            decoration: const InputDecoration(
              hintText: 'Enter a valid email'
            ) 
            ),
          TextField( 
            controller: _password,
            obscureText: true,
            autocorrect: false,
            enableSuggestions: false,
            decoration: const InputDecoration(
              hintText: 'Enter a password'
            )
            ),
          TextButton(
            onPressed: () async {
              await Firebase.initializeApp(
                options: DefaultFirebaseOptions.currentPlatform,
                );
              // final email = _email.text;
              // final password = _password.text;
              // final userCredential = 
              //  await FirebaseAuth.instance.createUserWithEmailAndPassword(email: email, password: password);
              // print(userCredential);
            },
            child: const Text('Register') ),
        ],
      ),
    );
  }
}

Expected behavior

It should work

Sample project

Providing a minimal example project which demonstrates the bug in isolation from your main App greatly enhances the chance of a timely fix. Please link to the public repository URL.


Additional context

I am a newbe


Flutter doctor

Click To Expand ``` [√] Flutter (Channel master, 3.19.0-6.0.pre.5, on Microsoft Windows [Version 10.0.22621.3155], locale en-IL) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Android Studio (version 2023.1) [√] VS Code (version 1.86.2) [√] Connected device (3 available) [√] Network resources ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 3.4.0-24.0.dev Flutter SDK 3.19.0-6.0.pre.5 sailist 1.0.0+1 dependencies: - cloud_firestore 4.14.0 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cupertino_icons 1.0.6 - firebase_analytics 10.8.0 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_auth 4.16.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 2.24.2 [firebase_core_platform_interface firebase_core_web flutter meta] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] dev dependencies: - flutter_lints 3.0.1 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service] transitive dependencies: - _flutterfire_internals 1.3.16 [collection firebase_core firebase_core_platform_interface flutter meta] - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - clock 1.1.1 - cloud_firestore_platform_interface 6.1.0 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.9.0 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - collection 1.18.0 - fake_async 1.3.1 [clock collection] - firebase_analytics_platform_interface 3.9.0 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.5.5+12 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_auth_platform_interface 7.0.9 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.8.13 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.10.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - js 0.6.7 [meta] - leak_tracker 10.0.3 [clock collection meta path vm_service] - leak_tracker_flutter_testing 2.0.3 [flutter leak_tracker leak_tracker_testing matcher meta] - leak_tracker_testing 2.0.3 [leak_tracker matcher meta] - lints 3.0.0 - matcher 0.12.16+1 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.8.0 [collection] - meta 1.11.0 - path 1.9.0 - plugin_platform_interface 2.1.8 [meta] - sky_engine 0.0.99 - source_span 1.10.0 [collection path term_glyph] - stack_trace 1.11.1 [path] - stream_channel 2.1.2 [async] - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.6.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - typed_data 1.3.2 [collection] - vector_math 2.1.4 - vm_service 13.0.0 ```

danagbemava-nc commented 7 months ago

Hi @hatyar, this appears to be an issue with your pub cache. Can you try running flutter pub cache clean and re-running flutter pub get and running your project again to see if you still experience the issue?

Also, can you switch to the stable channel? The master channel is experimental so it is likely to contain a lot of breaking changes which may not be compatible with the firebase plugins.

You can switch to the stable channel by running flutter channel beta and flutter upgrade

rrousselGit commented 7 months ago

This looks unrelated to Firebase. My bet is that you need a flutter pub upgrade or upgrade/downgrade your SDK.

That leak tracker stuff is fairly new and not stable, and is used by Flutter itself.

hatyar commented 7 months ago

thank you very much for the quick response. cleaning the cache and reloading it did not work. When I try to do a flutter channel beta I get this:

Switching channels failed error: Your local changes to the following files would be overwritten by checkout: dev/a11y_assessments/pubspec.yaml dev/automated_tests/pubspec.yaml dev/benchmarks/complex_layout/pubspec.yaml dev/benchmarks/macrobenchmarks/pubspec.yaml dev/benchmarks/microbenchmarks/pubspec.yaml dev/benchmarks/multiple_flutters/module/pubspec.yaml dev/benchmarks/platform_channels_benchmarks/pubspec.yaml dev/benchmarks/platform_views_layout/pubspec.yaml dev/benchmarks/platform_views_layout_hybrid_composition/pubspec.yaml dev/benchmarks/test_apps/stocks/pubspec.yaml dev/bots/pubspec.yaml dev/conductor/core/pubspec.yaml dev/customer_testing/pubspec.yaml dev/devicelab/pubspec.yaml dev/integration_tests/android_embedding_v2_smoke_test/pubspec.yaml dev/integration_tests/android_semantics_testing/pubspec.yaml dev/integration_tests/android_verified_input/pubspec.yaml dev/integration_tests/android_views/pubspec.yaml dev/integration_tests/channels/pubspec.yaml dev/integration_tests/deferred_components_test/pubspec.yaml dev/integration_tests/external_ui/pubspec.yaml dev/integration_tests/flavors/pubspec.yaml dev/integration_tests/flutter_gallery/pubspec.yaml dev/integration_tests/gradle_deprecated_settings/pubspec.yaml dev/integration_tests/hybrid_android_views/pubspec.yaml dev/integration_tests/ios_add2app_life_cycle/flutterapp/pubspec.yaml dev/integration_tests/ios_app_with_extensions/pubspec.yaml dev/integration_tests/ios_platform_view_tests/pubspec.yaml dev/integration_tests/non_nullable/pubspec.yaml dev/integration_tests/platform_interaction/pubspec.yaml dev/integration_tests/release_smoke_test/pubspec.yaml dev/integration_tests/spell_check/pubspec.yaml dev/integration_tests/ui/pubspec.yaml dev/integration_tests/web_e2e_tests/pubspec.yaml dev/integration_tests/wide_gamut_test/pubspec.yaml dev/integration_tests/windows_startup_test/pubspec.yaml dev/manual_tests/pubspec.yaml dev/tools/gen_defaults/pubspec.yaml dev/tools/gen_keycodes/pubspec.yaml dev/tools/pubspec.yaml dev/tools/vitool/pubspec.yaml dev/tracing_tests/pubspec.yaml examples/api/pubspec.yaml examples/hello_world/pubspec.yaml examples/image_list/pubspec.yaml examples/layers/pubspec.yaml examples/platform_channel/pubspec.yaml examples/platform_channel_swift/pubspec.yaml examples/splash/pubspec.yaml examples/texture/pubspec.yaml packages/flutter/pubspec.yaml packages/flutter/test_private/test/pubspec.yaml packages/flutter_driver/pubspec.yaml packages/flutter_goldens/pubspec.yaml packages/flutter_localizations/pubspec.yaml packages/flutter_test/pubspec.yaml packages/flutter_tools/pubspec.yaml packages/flutter_web_plugins/pubspec.yaml packages/fuchsia_remote_debug_protocol/pubspec.yaml packages/integration_test/example/pubspec.yaml packages/integration_test/pubspec.yaml Please commit your changes or stash them before you switch branches. Aborting.