dart

HTTP trigger Cloud Function in Flutter web

人走茶凉 提交于 2021-01-29 13:08:00
问题 I am trying to call a HTTP trigger Cloud Function from Flutter . I keep getting errors in the console while passing the parameters to the function. final HttpsCallable callable = CloudFunctions.instance.getHttpsCallable( functionName: 'hello_world', ); final HttpsCallableResult result = await callable.call( <String, dynamic>{ 'message': 'hello world!', }, ); Can someone point out what is it that I am doing wrong. The Cloud function used is def hello_world(request): request_json = request.get

Using model class in flutter (dart)

笑着哭i 提交于 2021-01-29 12:57:08
问题 I'm trying to create a model class with a few methods to simplify retrieving information from Firebase. I have a "Unregistered" page where user clicks on the "Login with google" button. If my user is already registered it checks the DB to see if he completed his profile, otherwise it writes basic data to the database with a field profileCompleted: false and redirects the user to the profile page so he can complete his profile. I'm trying to use a model here, but i'm getting all sorts of

On running my first time auto generated code in android studio is gives me an error

微笑、不失礼 提交于 2021-01-29 12:52:05
问题 This shows when I try to run the code without changing any word it gives me an error in android studio, and when I run flutter doctor it shows flutter and dart plugins are not installed but it is, when I asked that on stack overflow others told me it can be safely ignored I don't know what to do the question where I asked that Flutter doctor: Flutter and dart plugins not installed Launching lib\main.dart on Device in debug mode... Running Gradle task 'assembleDebug'... Checking the license

type 'Future<dynamic>' is not a subtype of type 'List<dynamic>' in type cast

六月ゝ 毕业季﹏ 提交于 2021-01-29 12:22:54
问题 I'm trying to get all the documents inside a determined collection from my firestore and after that, I want to set them in a list of documents which each position of the list represents a document. However, when I made the code, I received this error: type 'Future' is not a subtype of type 'List' in type cast import 'package:cloud_firestore/cloud_firestore.dart'; class Restaurant{ String keyword; String state; String address; String city; int evaluation; String image; String phone; double

Flutter GmailApi throws exception Object.noSuchMethod

我只是一个虾纸丫 提交于 2021-01-29 11:34:52
问题 I am trying to create a app which reads messages from Gmail and process them. I was able to achieve that in kotlin using GoogleAccountCredential and Gmail.Build APIs. But I am trying to do the same in Flutter, but no success so far. I have used https://pub.dartlang.org/packages/google_sign_in to sign in, and then create a HTTPClient similar to one mentioned in this post: How to use Google API in flutter? Then used that client to create GmailApi : https://github.com/dart-lang/googleapis/blob

How to get the size of a directory including its files

*爱你&永不变心* 提交于 2021-01-29 11:33:05
问题 I want to get the total size of a directory in flutter, including its files , files in its sub-folders and so on. I tried to use Directory.statSync , but it seems to only return the meta size of the directory itself. Should I recursively walk the directory to calculate the size? If so, is there a dart package that already does that (I can't find one)? If not, what more efficient way is available? 回答1: This is a example walk a directory recursively (sync version). Async version can be done

How to solve Exception Error: FirebaseApp with name [DEFAULT] doesn't exist?

喜你入骨 提交于 2021-01-29 11:24:54
问题 Here is where the exception is happening: @override Future<FirebaseUser> getCurrentUser() async { FirebaseUser user = await _firebaseAuth.currentUser(); return user; } The exact error is: Exception has occurred. PlatformException (PlatformException(error, FirebaseApp with name [DEFAULT] doesn't exist. , null)) My Flutter Doctor Output: [flutter] flutter doctor -v [√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17763.914], locale en-US) • Flutter version 1.12

A RenderFlex overflowed by 40 pixels on the bottom problem

爷,独闯天下 提交于 2021-01-29 11:13:53
问题 Another exception was thrown: A RenderFlex overflowed by 40 pixels on the bottom. I am getting this error. Please someone help me. I am new in flutter. I did change lots of things on the code but still couldn't change the result. import 'package:flutter/material.dart'; import 'package:estilo/pages/cart.dart'; class Cart_products extends StatefulWidget { @override _Cart_productsState createState() => _Cart_productsState(); } class _Cart_productsState extends State<Cart_products> { var Products

Closure call with mismatched arguments: function '_myListView.functionOne'

无人久伴 提交于 2021-01-29 10:12:55
问题 I don't know why this error is appearing in the console box. everything appears fine but still this below appears Closure call with mismatched arguments: function '_myListView.functionOne' Receiver: Closure: () => Null Tried calling: _myListView.functionOne(Instance of 'SliverMultiBoxAdaptorElement') Found: _myListView.functionOne() => Null HERE IS MY CODE FOR LISTVIEW import 'package:flutter/material.dart'; import 'package:linear_gradient/linear_gradient.dart'; import 'package:gradient_text

Setstate for statless widget dropdownButton from a stateful parent

半城伤御伤魂 提交于 2021-01-29 09:53:10
问题 I have three widgets first one is LightBulb(stateless) that have some color properties. The second one is widget named as LightColorSelector(stateless) that has a DropdownMenu with string type items Red , Green and Blue . And, the third class is Classroom(stateful widget) which is the parent of that two classes. My aim is to set the states from that class. I need to set a list of that three colors inside the Classroom , when someone clicks on one of the LightColorSelector items the LightBulb