Flutter Heroes
25.8K subscribers
272 photos
2 videos
31.1K links
Download Telegram
New post on /r/flutterdev subreddit:

Do we need a better way to write REST API clients (my approach provided)?
I'm developing my first Flutter app after many years as Android dev. I found that developing REST API client requires quite a lot of utility code around awesome http.get()/post(). I don't want to reinvent the wheel so asking if there is library to fulfill simple requirements. I want:to have option to print all requests/responses for debug purposes;to have an easy way to decode json response into an specific object;to handle API errors as call result (all non 2xx responses) where result is decoded json error response as custom object;to handle network errors as a call result (avoid using catch block);to use type safety as much as possible;Because I couldn't find handy lib, I come up with the solution where each API call can be constructed like this
 Future<ApiResult<Client>> addClient(String name) { return post( "/api/clients", payload: {"name": name}, resultFactory: (json) => Client.fromJson(json), ); } 
The result of API call is always an object: Success<T>, ApiError or NetError (all extending ApiResult).And on the caller side (with additional help of ApiResult.verify()) it looks as simple as this
Success<Client> result = (await _api.addClient(newClientName)).verify( // e.g. show dialog with error response from the server apiErrorHandler: (apiError) => ..., // e.g. provide retry button while on spotty network netErrorHandler: (netError) => ..., ); if (result == null) return; // at this point I can be sure request succeeded and Client object can be safely consumed as result.data 
No rocket science here, just a more friendly API to construct, debug and consume REST API.Should I extract this approach to the library or I'm doing all this wrong and there is more flutter/dart idiomatic way to deal with all that stuff?Appreciate your responses.

February 13, 2019 at 09:41PM by pilgr
http://bit.ly/2X11FrT
New post on /r/flutterdev subreddit:

Live Templates, or how to spend less time writing boilerplate code on Flutter with IntelliJ
http://bit.ly/2SS4JqY

February 13, 2019 at 10:12PM by Vanethos
http://bit.ly/2TICyrI
New post on Flutter Dev Google group:

Markup language
On my current project I’m using firebase and firestore with flutter. Right now I have an issue where I can only input information into a page from my database if it adheres to a very strict layout defined by my flutter page widgets. My question is. Is there a way to do something similar to

February 14, 2019 at 01:59AM by Brennan Altringer
http://bit.ly/2N6rsKO
New post on /r/flutterdev subreddit:

Samsung Galaxy S9 rotating image from camera
Hi, I'm trying to upload a camera image to a server on the Galaxy S9 but every time I do, it rotates the image by 90 degrees. Is this a common Samsung Problem or it's a library problem?If you need my code let me know.

February 14, 2019 at 12:05PM by gigab_te
http://bit.ly/2S2sdVL
New post on Flutter Dev Google group:

Navigation within Nested FutureBuilder
Hi, This is the SoF link: Click Here < https://stackoverflow.com/questions/54691767/navigation-within-nested-futurebuilder?noredirect=1#comment96173556_54691767> This is my Boot Screen and I want to create conditional Navigations but as I understand FutureBuilder does not have logic for

February 14, 2019 at 04:12PM by Esen
http://bit.ly/2N4PeXn
New post on /r/flutterdev subreddit:

[HELP Needed] How to pause flutter video(video_player plugin) when navigating from page to another.
I'm using flutter video_player(https://pub.dartlang.org/packages/video_player) plugin to play videos. But When I navigate from one page to another in flutter the video is still playing. I'm having the same problem when playing music from any other app(eg: playing music from notification while flutter video is playing). How can I pause it?

February 14, 2019 at 03:14PM by divyanshub024
http://bit.ly/2TOCBSZ
New post on Flutter Dev Google group:

Firebase Error - setTimestampsInSnapshotsEnabled(true)
I am getting this error when i will try to get data from firebase. Has anyone idea how to resolve that? ------------------------------------------------------------------------------ W/Firestore(23489): (0.6.6-dev) [Firestore]: The behavior for java.util.Date objects stored in Firestore is going

February 14, 2019 at 05:06PM by Pooja Patel
http://bit.ly/2GJjWEc
New post on Flutter Dev Google group:

build ios
how i can extract the ipa file from flutter app to debug it with my testers who using iphones . i have a mac virtual machine ,but i don't have an apple developer account and i can't pay for it . i think if i can extract the ipa file and then upload it to diawi , the problem will finish .

February 14, 2019 at 05:46PM by Kero Atef
http://bit.ly/2IcVwoZ
New post on /r/flutterdev subreddit:

Are Flutter apps easy to maintain and easy to change?
No text found

February 14, 2019 at 07:40PM by refine_and_refine
http://bit.ly/2BzsKcI
New post on /r/flutterdev subreddit:

Help with meteor and flutter
Hi, I'm a developer at react-native but I'm migrating to flutter and I wanted to know if there's any way to connect to my meteorbackend? https://pub.dartlang.org/packages/ddp this plugin does not explain how to use it and I have been advised not to use it, but my backend is done in meteor so I need to be able to have a ddp connection

February 14, 2019 at 08:16PM by levs0812
http://bit.ly/2NaPT9W
New post on /r/flutterdev subreddit:

Open source project flutter
Has anyone started open source project with flutter?Just curious to hear your insight.

February 14, 2019 at 08:38PM by bitcoin-wiz
http://bit.ly/2Sx9qHr
New post on Flutter Dev Google group:

CustomPainter Path.lineTo() shadow
I am using CustomPainter where I need to draw line class ShapesPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { final Paint firstPaint = Paint(); firstPaint.color = const Color.fromARGB(255, 236, 0, 140); final Path firstPath = Path();

February 14, 2019 at 10:02PM by Dshah H
http://bit.ly/2GskUpg
New post on /r/flutterdev subreddit:

"Best" way to update ListView with data coming in from mqtt
I am new to Flutter. I am finding all the various ways to handle state changes quite rich but a bit daunting. I am hoping some kind person will point me to what would be "the best" path to take given this scenario. I have devices that publish to an mqtt broker. In my Flutter app, I have successfully been able to subscribe and receive updates from the broker. Now I want to update a Flutter UI widget. I assume for the UI to use StreamBuilder. The tricky part for me is construction of the stream to put in the stream property. Do I need to use an event channel, Some other Stream mechanism that can be instantiated when the mqtt subscribe callback is called with data? Thank you.

February 14, 2019 at 11:50PM by m_k_johnson
http://bit.ly/2GLID2X