Flutter

How to know pop event happened inside Nested Widget in Flutter

。_饼干妹妹 提交于 2021-02-05 11:31:49
问题 I am currently building app where I need to use Nested Routing keeping one screen same and routing on different one. I want to when that second route is popped so that I can change value of expanded to fill whole screen. Gist in Github. Here is code sample: import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title:

What is the @macro annotation in Flutter and Dart documentation

丶灬走出姿态 提交于 2021-02-05 10:43:06
问题 When I'm reading the source code I often see something like this (from TextField): /// {@macro flutter.widgets.editableText.keyboardType} final TextInputType keyboardType; What does the @macro mean? I found the answer so I'm posting it below as a self-answer Q&A. 回答1: A @macro is a way to insert some dartdoc documentation that has been written somewhere else. That way you don't have duplicate docs that you have to maintain. The string that follows @macro is the name of a template, which

ios notification not working on background, foreground

怎甘沉沦 提交于 2021-02-05 09:33:34
问题 I want to use notification when app pause mode(foreground) and app kill (background), Only notification working on when the app opens (app running). I used this on Flutter project. enable Background Mode(Background fetch, Remote notifications) and push notification @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { Messaging

ios notification not working on background, foreground

牧云@^-^@ 提交于 2021-02-05 09:33:09
问题 I want to use notification when app pause mode(foreground) and app kill (background), Only notification working on when the app opens (app running). I used this on Flutter project. enable Background Mode(Background fetch, Remote notifications) and push notification @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { Messaging

Receiver:null error when trying to save form using globalKey

萝らか妹 提交于 2021-02-05 09:22:43
问题 I'm following this https://medium.com/@c_innovative/simple-firebase-login-flow-in-flutter-6f44c2b5c58a tutorial and i am having some trouble with getting the login in to work. I have already connected my app to firebase and enabled email and password authentication on firebase console! I have tried entering the key argument into the TextFormfield but so far im unable to do so. class LoginPage extends StatefulWidget { @override State<StatefulWidget> createState() { return _LoginPageState(); }

Receiver:null error when trying to save form using globalKey

这一生的挚爱 提交于 2021-02-05 09:22:05
问题 I'm following this https://medium.com/@c_innovative/simple-firebase-login-flow-in-flutter-6f44c2b5c58a tutorial and i am having some trouble with getting the login in to work. I have already connected my app to firebase and enabled email and password authentication on firebase console! I have tried entering the key argument into the TextFormfield but so far im unable to do so. class LoginPage extends StatefulWidget { @override State<StatefulWidget> createState() { return _LoginPageState(); }

Your Cloud Firestore database has insecure: any user can read your entire database

放肆的年华 提交于 2021-02-05 09:14:09
问题 Building an app, using Firestore database for its content. Rules are: service cloud.firestore { match /databases/{database}/documents { // Allow public read access, but only content owners can write match /{document=**} { allow read: if true allow write: if request.auth.uid == request.resource.data.author_uid } } } As the warning says, I have allow read just set to true , which I understand, is a problem. How do I make it so my Flutter app can read the contents of my Firestore database, but

How to avoid race condition?

独自空忆成欢 提交于 2021-02-05 08:59:05
问题 I am make random 1:1 chat app with Flutter and Firestore. But I have race condition when I am connect second user to chat. This my client app code for add second user to Firestore (first user is already add to Firestore document): await chatRoomReference.setData({ ‘secondUserUID': uid, }); When second user tap to chat I am remove option to enter this chatroom from all client UI. But is possible that if third user tap to chat at same time (before UI get update from stream) he will also be add

Firebase: flutter want to get a null value

女生的网名这么多〃 提交于 2021-02-05 08:54:07
问题 I want to get data that is null in a Firebase database stream: Firestore.instance .collection('resep') .where("email", isEqualTo: null) .snapshots(), I want to get email data that is null 回答1: From the documentation: where(dynamic field, { dynamic isEqualTo, dynamic isLessThan, dynamic isLessThanOrEqualTo, dynamic isGreaterThan, dynamic isGreaterThanOrEqualTo, dynamic arrayContains, bool isNull }) → Query Creates and returns a new Query with additional filter on specified field. field refers

How do I read and write a text file from firebase storage in Flutter?

帅比萌擦擦* 提交于 2021-02-05 08:40:49
问题 I need to make a storage for my saved images in firebase storage. Is there a way I can read and write to online text file on firebase storage in flutter? Is there any alternative to make my images storage? 回答1: It's so simple. Let's explain the solution with the example. import the library as following : import package:firebase_storage/firebase_storage.dart' as firebase_storage; Secondly, get the firebase reference by : firebase_storage.Reference ref = firebase_storage.FirebaseStorage