Questions tagged [dart]

0

votes
0

answer
3

Views

Show Local Images and Server Images ( with Caching) in Flutter

I am trying to show the image in a Widget picked from Image-Gallery as well as from the Network loaded images. CachedNetworkImage is working fine with Network-images but when I try to pass selected image from gallery it's not working. CachedNetworkImage( imageUrl: url, placeholder: (context, url)...
user532445
1

votes
1

answer
62

Views

Get all subclasses in dart

I am trying to get all the subclasses of a given class following this post Find all subclasses in dart like this: import 'dart:mirrors'; class A {} class B extends A{} List getSubclasses(Type type) { List subClasses = []; MirrorSystem mirrorSystem = currentMirrorSystem(); // NoSuchMethodError: Class...
1

votes
1

answer
120

Views

What happened to Dart's Expect?

Some Dart code I'm maintaining uses Expect.equals, Expect.isTrue, and others. Expect no longer appears to be part of Dart. There is no mention of its disappearance in the changelog. Questions: Where should I be looking when there is a breaking change such as this? Every year for the past five yea...
Neil Fraser
1

votes
2

answer
499

Views

Can I call Kotlin function from Dart

Using Flutter, a kotlin/swift function can be called by something like: file.dart: static const platform = const MethodChannel('my.test.flutterapp/battery'); final int result = await platform.invokeMethod('getBatteryLevel'); file.kt: private val CHANNEL = 'my.test.flutterapp/battery' MethodChannel(f...
Hasan A Yousef
1

votes
1

answer
60

Views

Unit testing PODO constructor exceptions in dart

This is my constructor: Merchant( this._firstName, this._lastName, this._company, this._buildingNumber, this._location, this._city, String pin, String phone, String email, this._image) { _validatePin(pin) ? _pin = pin : throw pinFormatException; _validatePhone(phone) ? _phone = phone : throw phoneFo...
Raveesh Agarwal
1

votes
1

answer
4k

Views

flutter loop inside a widget

I'm new to flutter and was wondering if anyone would be able to guide me. I would like to irritate through a string that I retrieved from a json file. I would like to display each letter separately. Example below. Output Complete Word: Hi Letter pos 0: H Letter pos 1: I What I tried so far is addin...
Ouardia
1

votes
1

answer
363

Views

How to change colour scroll-overflow indicators?

When the user scrolls to the edge of a list or TabView, an animated blue circle appears on the ending edge. What is this called, and how do I change the colour of it? Cheers.
haz
1

votes
1

answer
975

Views

Flutter: Firebase Pushnotification On Data Change

After getting the comment, i have deployed this folowing code to my firebase project and it was successfully deploed!.But there is no notifications been send to me. Please check my Firebase Realtime database Screenshot here for better understanding. [ITS SOLVED NOW:IT WILL SEND NOTIFICATIONS TO ONL...
Rajesh Jr.
1

votes
2

answer
1k

Views

Flutter - Create dynamic number of texteditingcontrollers

I am recreating an app I have previously made in Swift, and on one of my pages we call an API and based on the results, we present the user a dynamic number of textfields to search by different search parameters. Is there any good way to do this in Dart/Flutter? Since dart doesn't support generatin...
Matt Lampe
1

votes
1

answer
41

Views

In Dart / IntelliJ Idea how to make it an error when you miss a return?

In Dart / IntelliJ Idea how to make it an error (not a simple warning) when you miss a return? If I forget to add a return, it's a simple warning, it's very easy to miss, and this makes me waste a lot of time. warning: This function declares a return type of 'RichText', but doesn't end with a return...
MarcG
1

votes
1

answer
1.2k

Views

Update UI after removing items from List

I want to update my ListView if i remove or add items. Right now i just want to delete items and see the deletion of the items immediately. My application is more complex so i wrote a small example project to show my problems. The TestItem class holds some data entries: class TestItem { static int i...
Jens
1

votes
1

answer
509

Views

Flutter (Dart) remove firebase database Listener

I add an firebase database Listener to my flutter project as below: databaseReference = database.reference().child('community_board'); databaseReference.onChildAdded.listen(_onEntryAdded); databaseReference.onChildChanged.listen(_onEntryChanged); For Kotlin and swift of firebase, I have to remove th...
GPH
1

votes
1

answer
1k

Views

Flutter- compute method

I'm trying to execute heavy method by compute(). I tried like so. After loop executed, Text widget update but result returns 0 almost right after button was pressed. Does anyone know what am I missing? int _counter; static int loop(int val) { int count = 0; for (int i = 1; i
Daibaku
1

votes
1

answer
697

Views

How to go on about receiving JSON array in flutter and parsing it?

I am trying to get a JSON array from a webservice URL and parse it in JSON. The thing is the tutorial I was following shows receving one JSOn obj and parsing it but I need to know how to receive a JSON array and parse it. Below is the code I am working on, I am stuck. Model class Fact { int id; int...
defiant
1

votes
1

answer
703

Views

Flutter: add a floating action button to an image

I'm trying to add a floating action button to an image. The button will be used to change the selected image. I want the button to float over the bottom right of the image. So far all I can do is add the floating action button directly below the image. Thanks for any help! @override Widget build(Bui...
nalyd88
1

votes
1

answer
598

Views

Flutter parsing json with DateTime from Golang RFC3339: FormatException: Invalid date format

When trying to read json files generated with golangs json package in Dart / Flutter I noticed that parsing dates produce an error: FormatException: Invalid date format An example is the following json generated on the Go server: { ... 'dateCreated': '2018-09-29T19:51:57.4139787-07:00', ... } I am u...
Oswin Noetzelmann
1

votes
2

answer
225

Views

Flutter: how to avoid special characters in validator

I have this validation function: class FormFieldValidator{ static String validate(String value, String message){ return (value.isEmpty || (value.contains(**SPECIAL CHARACTERS**))) ? message : null; } } I would like to indicate that doesn't have to contain special characters, but how can I say it?
Little Monkey
1

votes
1

answer
791

Views

How to inner-join in firestore

I want to build a view to show some events inside a listview in my app like this: I have these two tables: Users   Events But I don't know how do a 'inner join' between the tables USERS and EVENTS... I tried this: import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/materi...
Matheus Ribeiro
1

votes
1

answer
923

Views

Make AppBar transparent and show background image which is set to whole scrren

I have added appBar in my flutter application. My screen already have a background image, where i don't want to set appBar color or don't want set separate background image to appBar. I want show same screen background image to appBar also. I already tried by setting appBar color as transparent but...
Rahul Mahadik
1

votes
2

answer
490

Views

Center widget vertically inside a SingleChildScrollView

I'm new to Flutter so I train myself by making a simple form. I realized while I was debugging on my iPhone the virtual keyboard triggered an error : 'A RenderFlex overflowed by 29 pixels on the bottom'. I fixed this issue by wrapping my Container inside a SingleChildScrollView. The problem now is...
Hurobaki
1

votes
1

answer
77

Views

Dart What does “StreamTransformer<RS, RT> cast<RS, RT>()” do?

I've implemented the stream transformer. Please note that it is only an exercise (in order to learn Dart). This transformer converts integers into strings. I give the code below, and you can also find it on GitHub. // Conceptually, a transformer is simply a function from Stream to Stream that // is...
Denis Beurive
1

votes
1

answer
902

Views

How can I have my AppBar in a separate file in Flutter while still having the Widgets show?

I am currently building a Flutter app that recommends restaurants around the area. However, I've gotten myself in quite the kerfuffle. I want my app to have the code for the AppBar separate from the code for each screen for the sake of organization and cleanliness. So, I built KainAppBar.dart as th...
Xavier Paolo Jamito
1

votes
2

answer
493

Views

flutter : how to persist a List<num> using shared preferences?

how to persist a List like List = [2.5, 5, 7.5, 10] using SharedPreferences please ? EDIT : how to convert stored data as String or List to List ?
ViralCode
1

votes
1

answer
44

Views

Unable to find modules when routing Dart Angular Tour of Heroes

I have been following the Dart Angular Tour of Heroes tutorial. I made it to part 5, where routing is taught. But I got stuck at the section where the router is made available. I typed out the code, but it does not build. I get the following error: [SEVERE] build_web_compilers|entrypoint on web/main...
Comrade SparklePony
1

votes
1

answer
294

Views

How to let vim do syntax highlight right for flutter?

Some background: I am using VSCode for coding in flutter. But when I open many workspaces, it ate all my free RAM quickly (Macbookpro 8GB). (IntelliJ is even worse.) Sometimes, I just need to check other workspaces' Code etc.. So The best option is to use vim for this purpose. I have installed dart-...
sgon00
1

votes
1

answer
569

Views

Flutter textfield background color on focus

I have a rounded textfield. It works good, but when user tap on it, a grey color background appears. How can I disable that splash effect? This is my code and result: new Container( margin: const EdgeInsets.only(left: 30.0, top: 60.0, right: 30.0), height: 40.0, decoration: new BoxDecoration( color...
hesam
1

votes
2

answer
254

Views

Make Function parameter optional in custom widget flutter

I try to create some custom widget with some parameter in the constructor. This widget has some optional and required parameter. how can make Function type parameter optional in my Widget. class TextInputWithIcon extends StatefulWidget { final String iconPath; final String placeHolder; final Functio...
Saman
1

votes
1

answer
134

Views

How to properly wait until future is complete in dart

There is a slight bug in my app made with Flutter, that when the user has signed in, it fetches the user information from my database but not fast enough and causes a visual error on my front end of the app. The app has layouts that use the user information (name, location, and image) and it is not...
user3152311
1

votes
1

answer
109

Views

Calling setState() during build without user interaction

What I did : I have integrated FCM (Firebase Cloud Messaging) in my flutter app. I shared the context and the setState() of each page in static variables with these two lines getting called in all the build functions of my pages : @override Widget build(BuildContext context) { StaticClass.currentCon...
Khalil Bz
1

votes
2

answer
21

Views

Reference to this in anonymous function Dart.js

Is it possible to get a reference to this of creating an object in an anonymous function: var marker = Marker( icon: BitmapDescriptor.defaultMarker, onTap: () { ///
Michał Jurczuk
1

votes
2

answer
45

Views

Converting Map<key, value> to List<value>

I've been searching for a while without success. I am trying to convert a Map to a List (discarding key). Sure, I can do var addictionList = new List(); dataMan.forEach((String date, AddictionDay day) { addictionList.add(day); }); but is there a more straight approach, like var addictionList = dat...
Martin.
1

votes
1

answer
44

Views

Making a Text Widget visible after button click

I have a basic login page that consists of an 'email', 'password' and a 'SwitchListTile' (Switch) that users will select to confirm reading of legal documents. On 'Login', I would like the 'Text' to show. Default is invisible. I implemented the visibility of the Text using the 'Visibility' class. No...
Milie
1

votes
2

answer
85

Views

What is the difference between Scaffold and MaterialApp in Flutter?

I have two screens, where First: Listing of data from Firebase Second: Add data in that screen so I want to comeback to first screen, Everything working fine only there was a black screen when I go back. Now issue was gone, I have searched for how it works but its still not clear my concept about t...
richa shah
1

votes
2

answer
119

Views

dart how to assign list into a new list variable

I am trying to extend a list just by using add method like this List mylists = ['a', 'b', 'c']; var d = mylists.add('d'); print(d); It gives error This expression has type 'void' and can't be used. print(d); Why i cannot save the list in a new variable? Thank you
sadek
1

votes
2

answer
24

Views

Dart/Flutter DateTime difference inDays error for March 31 April 1

I am trying to get the difference in Days between two dates picked from a DatePicker. This works fine except for ONE single date : March 31. The difference in Days between two DateTimes is wrong by 1 day when one of the dates is March 31. I know this is due to Light Saving and March is 30.9… days...
Benjamin
1

votes
2

answer
58

Views

How to design a user center ui like this using dart

I'm familiar with Column and Row. But the complex UI in my image example, I don't know how to begin, ignoring the Chinese words.
Vincent
1

votes
2

answer
66

Views

How to run multiple async functions in order they were called (FIFO?)

I've spent many hours looking for the solution, but since I am Dart begginer, I couldn't find it out by myself. What I want to achieve is to create something like queue for some of the async functions that are called randomly (let's say, when user is tapping a button in my app) from different points...
vespi
1

votes
3

answer
38

Views

How to add shadows to Text in Flutter

How to add shadows to text. Under the TextStyle there is a shadows property also. It will be helpful if you can include example for its implementation
Mangaldeep Pannu
0

votes
0

answer
3

Views

PhpStorm - Two Dart web apps in one project

I have a Dart project in PhpStorm and I have two web (Angular Dart) modules (or subprojects?) I have a problem how to run/debug them as PhpStorm created very same JavaScript Debug configurations. When I had only one it worked well. Directory structure is ~/Zdrojaky/src/dart/app/Vavrinec (the main pr...
Martin Edlman
0

votes
0

answer
4

Views

ExpansionPanelList not expanding nor collapsing ExpansionPanel

I'm using ExpansionPanel()s inside a Tab(). The ExpansionPanel() shows correctly. But its isExpanded attribute never changes (and yes, I have a line that should change it) making it impossible to collapse or expand the ExpansionPanel() I tried to use the answers of Expansion Panel List in Flutter an...
Alejandro Garcia

View additional questions