Flutter

How to update Firebase token in Flutter application after it expires and store it?

本小妞迷上赌 提交于 2021-02-18 07:25:34
问题 I have created authentication with google on first time start up of app and I have my own _authenticatedUser which stores user token for further requests. final FirebaseAuth firebaseAuth = FirebaseAuth.instance; final GoogleSignIn googleSignIn = GoogleSignIn(); Future<String> signInGoogle() async { GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); GoogleSignInAuthentication gsa = await googleSignInAccount.authentication; FirebaseUser user = await firebaseAuth

How to update Firebase token in Flutter application after it expires and store it?

筅森魡賤 提交于 2021-02-18 07:25:17
问题 I have created authentication with google on first time start up of app and I have my own _authenticatedUser which stores user token for further requests. final FirebaseAuth firebaseAuth = FirebaseAuth.instance; final GoogleSignIn googleSignIn = GoogleSignIn(); Future<String> signInGoogle() async { GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); GoogleSignInAuthentication gsa = await googleSignInAccount.authentication; FirebaseUser user = await firebaseAuth

Flutter: make build-time environment variables available to code

邮差的信 提交于 2021-02-18 06:09:11
问题 How can I have build-time environment variables available to code within a Flutter app? (My specific use case is to inject app version number and commit hash into a debug screen. This information is available at build time, but not at runtime). I had hoped to be able to do something like: flutter run --dart-define=APP_VERSION=0.1.2 And then, const appVersion = String.fromEnvironment('APP_VERSION', defaultValue: 'development'); But this doesn't seem to work (I'm using Flutter 1.12.13+hotfix.5)

Flutter: make build-time environment variables available to code

北城以北 提交于 2021-02-18 06:05:43
问题 How can I have build-time environment variables available to code within a Flutter app? (My specific use case is to inject app version number and commit hash into a debug screen. This information is available at build time, but not at runtime). I had hoped to be able to do something like: flutter run --dart-define=APP_VERSION=0.1.2 And then, const appVersion = String.fromEnvironment('APP_VERSION', defaultValue: 'development'); But this doesn't seem to work (I'm using Flutter 1.12.13+hotfix.5)

How to use Skia / CanvasKit in Flutter Web?

自闭症网瘾萝莉.ら 提交于 2021-02-18 05:33:32
问题 I know that Flutter supports using Skia instead of DomCanvas in Flutter Web using WASM CanvasKit, i.e. "Skia + WebAssembly". I have heard that this provides significant performance improvements, however, I do not know how to enable it. 回答1: You can enable CanvasKit / Skia in Flutter Web by supplying a Dart environment constant: flutter run -d chrome --dart-define=FLUTTER_WEB_USE_SKIA=true The flutter tools now have a good shortcut for it: flutter run -d chrome --web-renderer canvaskit The -

Implement GraphQL & Flutter

非 Y 不嫁゛ 提交于 2021-02-18 03:39:00
问题 Is there a way to implement GraphQL in flutter? I was trying making the API call with the query and variables objects in a JSON object. type '_InternalLinkedHashMap' is not a subtype of type 'String' in type cast 回答1: I have been using graphql_flutter package for a few weeks now and it seems to work well enough. Here is an example: import 'package:graphql_flutter/graphql_flutter.dart' show Client, InMemoryCache; ... Future<dynamic> post( String body, { Map<String, dynamic> variables, }) async

Implement GraphQL & Flutter

穿精又带淫゛_ 提交于 2021-02-18 03:38:06
问题 Is there a way to implement GraphQL in flutter? I was trying making the API call with the query and variables objects in a JSON object. type '_InternalLinkedHashMap' is not a subtype of type 'String' in type cast 回答1: I have been using graphql_flutter package for a few weeks now and it seems to work well enough. Here is an example: import 'package:graphql_flutter/graphql_flutter.dart' show Client, InMemoryCache; ... Future<dynamic> post( String body, { Map<String, dynamic> variables, }) async

How to detect scroll position of ListView in Flutter

巧了我就是萌 提交于 2021-02-17 21:10:40
问题 I'm using ListView widget to show items as a list. In a window three, items viewing must the middle item place in the middle. So how can I detect position of ListView when scrolling stop? How to detect ListView Scrolling stopped? 回答1: I used NotificationListener that is a widget that listens for notifications bubbling up the tree. Then use ScrollEndNotification , which indicates that scrolling has stopped. For scroll position I used _scrollController that type is ScrollController . new

How to detect scroll position of ListView in Flutter

百般思念 提交于 2021-02-17 21:10:07
问题 I'm using ListView widget to show items as a list. In a window three, items viewing must the middle item place in the middle. So how can I detect position of ListView when scrolling stop? How to detect ListView Scrolling stopped? 回答1: I used NotificationListener that is a widget that listens for notifications bubbling up the tree. Then use ScrollEndNotification , which indicates that scrolling has stopped. For scroll position I used _scrollController that type is ScrollController . new

Flutter学习笔记(30)--Android原生与Flutter混编

邮差的信 提交于 2021-02-17 20:38:24
如需转载,请注明出处: Flutter学习笔记(30)--Android原生与Flutter混编 这篇文章旨在学习如何在现有的Android原生项目上集成Flutter,实现Android与Flutter的混编,文章主体内容分为5部分,如下: Android项目如何集成FlutterModule Flutter视图是如何展示到前台界面的 Flutter与Weex对比 如何进行原生页面跳转到Flutter页面 原生如何与Flutter进行传值通信(以EventChannel为例说明) 接下来我会按照上面列出来的5点,逐一的进行实例讲解说明 1.Android项目如何集成FlutterModule Android原生项目集成Flutter有两种方式,一种是在原生项目内集成FlutterModule,还有一种是将FLutter项目打包成arr文件,然后以组件的形式被原生项目依赖。这里我们就只说一下在原生项目内集成FlutterModule。 第一步:在主工程下创建FlutterModule,File->New->New Flutter Project,然后选择Flutter Module点击Next。 设置完成之后点击Finish,创建完module后我们来看一下工程的目录结构 第二步:在app下的build.gradle添加依赖 // 在android下添加jdk1.8支持