- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
[dart] 未为类“FirebaseAuth”定义方法“signInWithCredential”。 [undefined_method]
我的 main.dart 代码
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:aut'
final FirebaseAuth _auth = FirebaseAuth.instance;
final GoogleSignIn _googleSignIn = GoogleSignIn();
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
_MyHomePageState(){
print("constrcer is called");
}
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
Future<String> _testSignInWithGoogle() async {
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
final FirebaseUser user = await _auth.signInWithCredential(credential);
assert(user.email != null);
assert(user.displayName != null);
assert(!user.isAnonymous);
assert(await user.getIdToken() != null);
final FirebaseUser currentUser = await _auth.currentUser();
assert(user.uid == currentUser.uid);
return 'signInWithGoogle succeeded: $user';
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
我的发布文件
name: myappname description: A new Flutter project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org. version: 1.0.0+1
environment: sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies: flutter:
sdk: flutter
banner: ^0.1.3 cloud_firestore: ^0.8.2 http: ^0.12.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2 sqflite: any firebase_auth: ^0.6.6 firebase_core: ^0.2.5+1 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.
dev_dependencies:
google_sign_in: ^3.0.4
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter. flutter:
# The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true
# To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # fonts: # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf # - asset: fonts/Schyler-Italic.ttf # style: italic # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf #
- asset: fonts/TrajanPro_Bold.ttf # weight: 700 # # For details regarding fonts from package dependencies, # see https://flutter.io/custom-fonts/#from-packages
> Blockquote
最佳答案
尝试将新版本的包放入您的 pubspec.yaml
dependencies:
firebase_auth: ^0.6.2+1
firebase_database:
firebase_core: ^0.2.5+1
关于firebase-authentication - 方法 'signInWithCredential' 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53783070/
我刚刚设置了新的 Firebase 托管以及我的自定义域和我的网页等... 一切都很好,除了真正困扰我的是默认域: projectname.web.app projectname.firebaseap
Firebase 云消息传递和 Firebase 应用内消息传递有什么区别?它们都会向您的应用发送发生了某些事情的通知。我查看了他们的文档,这些是他们的单行描述: Firebase 云消息传递: Fi
是否有任何工具可以帮助将数据从开发迁移到登台再到生产?如果没有,是否有计划 build 它们? 我知道您可以从 Forge 导出 JSON 和导入 JSON,但这不包括授权和安全设置。 最佳答案 我们
firebase 网络应用和 firebase 托管有什么区别?据我所知,网络应用程序用于实际上只是浏览器的应用程序,并且 firebase 托管仅用于网站。 最佳答案 Firebase for We
我有两个 firebase 项目 F1 和 F2。我正在使用基于密码的身份验证来识别 F1 上的用户。我希望在 F2 中识别相同的用户。所以我正在考虑以下基于 this question 的场景: C
正在使用 firebase 云功能 构建服务器,我需要其他服务器来调用我的服务器端点。最重要的是,我需要这些调用我的服务器的第三方域进行身份验证。 问题 1:如何创建这样的服务帐户,在调用中包含服务帐
我开发了一个应用程序来测试使用 flutter 和谷歌身份验证的谷歌登录功能。该项目是一个封闭的项目,只有我可以访问它。但最近我看到有一个来自未知电子邮件 ID 的谷歌登录。用户如何在没有构建我的应用
我有 2 个存储库,一个用于 firebase 功能,另一个用于静态 firebase 托管 react 站点。他们都使用相同的firebase项目。 myfirebaseproject --- fi
背景 -我正在设置一项新功能,允许用户选择他们所在的城市,因为我的应用程序是一个公共(public)交通应用程序。我希望城市位于单独的数据库中,为此我在我的 firebase 项目中创建了一个辅助数据
我构建了一个网络平台,允许用户使用一个用户帐户注册多个网络应用程序。每个应用程序都有自己独立的 Firebase 数据库。是否可以使用 firebase 身份验证并在各种 firebase 数据库之间
在 Firebase 控制台内的 Cloud Messaging View 下,用户可以创建测试通知。此功能还允许您安排通知将发送到一个设备或一组设备的时间。 是否可以创建和发送预定 使用 Fireb
我们正在为我们最近的项目使用 firebase 平台。我们最近推出并一直在监控使用情况。 我可以在 firebase 控制台中看到 firebase 调用的总数,但找不到查看每个函数调用次数的方法。
我正在开发一个使用 Webpack 捆绑模块的 Web 应用程序。无论出于何种原因,在应用程序中引入 Firebase 都会导致 Webpack 抛出错误。当 Webpack 尝试加载 Firebas
我无法在 firebase 控制台中提交支持请求。 登录 Firebase 控制台 导航至 https://firebase.google.com/support/contact/troublesho
我安装 Firebase CLI (firebase-tools) https://github.com/firebase/firebase-tools通过此代码: curl -sL firebase
在我的应用程序中,我尝试使用Firebase crash10.2.1,但无法获得编译的好处。我不断收到消息: 'Failed to resolve:com.google.firebase:fireba
我的 firebase 应用有一个注册用户列表。这些是通过电子邮件和密码身份验证创建的。 我想将 Firebase 数据和用户列表传输到另一个 Firebase 应用。 传输 firebase 数据很
如果我将数据插入到 firebase 中的 node/a/0 中。 结果将把a视为数组a[0]。 同样,如果我在 node/a/1 中设置数据,第一个数组将变为 null "a" : [
我是 Firebase 新手,我正在尝试 Firebase 数据库规则和 Firebase 身份验证。 我尝试使用 firebase 身份验证来执行 firebase 数据库规则。 因此,我创建了一封
所以场景如下: 当我从 Firebase 存储访问文件时: 我从存储桶获取文件(.html、.png、.zip 等)(尺寸较小,不超过 2mb)。 将该文件存储在我的本地存储中,这样应用就不需要再次下
我是一名优秀的程序员,十分优秀!