首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >尝试将名称更正为现有getter的名称,或定义名为“MethodChannelFirebase”的getter或字段。

尝试将名称更正为现有getter的名称,或定义名为“MethodChannelFirebase”的getter或字段。
EN

Stack Overflow用户
提问于 2022-05-31 15:18:24
回答 1查看 2.2K关注 0票数 1
代码语言:javascript
运行
复制
import 'package:booktest/model/profile.dart';
import 'package:flutter/material.dart';
import 'package:form_field_validator/form_field_validator.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_auth/firebase_auth.dart';

class RegisterScreen extends StatefulWidget {
  const RegisterScreen({Key? key}) : super(key: key);

  @override
  State<RegisterScreen> createState() => _RegisterScreenState();
}

class _RegisterScreenState extends State<RegisterScreen> {
    final formkey = GlobalKey<FormState>();
  Profile profile = Profile(
    email: '',
    password: '',
  );

 final Future<FirebaseApp> firebase = Firebase.initializeApp();
  @override
  Widget build(BuildContext context) {  
    return FutureBuilder(
      future: firebase,
      builder: (context, snapshot) {
         if (snapshot.hasError) {
            return Scaffold(
              appBar: AppBar(
                title: const Text("Error"),
              ),
              body: Center(
                child: Text("${snapshot.error}"),
              ),
            );
          }
          if (snapshot.connectionState == ConnectionState.done){
          }
          if (snapshot.hasData) {
            return const Scaffold(


              body: Center(
                child: CircularProgressIndicator(),
              ),
            );
          }
          return const CircularProgressIndicator();
    });}}

代码语言:javascript
运行
复制
* 
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/firebase_core_platform_interface.dart:21:6: Error: Can't use '/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/src/method_channel/method_channel_firebase.dart' as a part, because it has no 'part of' declaration.
part 'src/method_channel/method_channel_firebase.dart';
     ^

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/src/method_channel/method_channel_firebase_app.dart:50:11: Error: The getter 'MethodChannelFirebase' isn't defined for the class 'MethodChannelFirebaseApp'.
- 'MethodChannelFirebaseApp' is from 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/firebase_core_platform_interface.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'MethodChannelFirebase'.
    await MethodChannelFirebase.channel.invokeMethod<void>(
          ^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/src/method_channel/method_channel_firebase_app.dart:55:5: Error: The getter 'MethodChannelFirebase' isn't defined for the class 'MethodChannelFirebaseApp'.

- 'MethodChannelFirebaseApp' is from 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/firebase_core_platform_interface.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'MethodChannelFirebase'.
    MethodChannelFirebase.appInstances.remove(name);
    ^^^^^^^^^^^^^^^^^^^^^

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/src/method_channel/method_channel_firebase_app.dart:63:11: Error: The getter 'MethodChannelFirebase' isn't defined for the class 'MethodChannelFirebaseApp'.
- 'MethodChannelFirebaseApp' is from 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/firebase_core_platform_interface.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'MethodChannelFirebase'.
    await MethodChannelFirebase.channel.invokeMethod<void>(
          ^^^^^^^^^^^^^^^^^^^^^

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/src/method_channel/method_channel_firebase_app.dart:74:11: Error: The getter 'MethodChannelFirebase' isn't defined for the class 'MethodChannelFirebaseApp'.
- 'MethodChannelFirebaseApp' is from 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/firebase_core_platform_interface.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'MethodChannelFirebase'.
    await MethodChannelFirebase.channel.invokeMethod<void>(

          ^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-4.4.0/lib/src/platform_interface/platform_interface_firebase.dart:30:39: Error: Method not found: 'MethodChannelFirebase'.
  static FirebasePlatform _instance = MethodChannelFirebase();
                                      ^^^^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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 26s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
*
EN

回答 1

Stack Overflow用户

发布于 2022-09-15 13:36:12

更改失败包的版本解决了我的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72450361

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档