Is it okay to to allocate chat feature to someone who probably does it better than you?

Styling out getstream.io’s flutter package 🤩

We all have probably written chat apps, multiple times in our lives, and we all know that IT TAKES TIME! So I always wondered is there a way to make totally custom and beautiful chat app by using some lib/service that does all the heavy lifting for me.

So, few weeks ago, I came across Stream, a chat service for quickly adding interactive messaging to your application. I was blown away when I saw they support Flutter and provide pre-built widgets.

Fully blown chat app in a matter of hours?
FOR FREE?
Are you kidding me? :D

After 6–7 hours…


Why can’t I catch this Exception?

Is there a difference when using await?

When using try/catch there is a difference when using await or not in front of your async function. If you do not wait your async function to be finished, catch section will not be called when an exception is fired inside you async method.

void main() {
try {
catchMeIfYouCan();
} catch (e) {
print(e.toString());
}
}
Future<void> catchMeIfYouCan() async {
await Future.delayed(Duration(seconds: 1), () {
throw Exception('did you?');
});
}

Console output for this example looks like this:

Uncaught Error: Exception: did you?

But, if you add await in front of the catchMeIfYouCan() method call:

void main() async {…


Can you do it? Should you do it?

Parent and its baby widget :)

Extension is possible, as you can see from the picture above. Extending StatefulWidget is a bit more complex than a stateless one, but nothing to be afraid of.

Stateless


Custom animated in-app notifications that are super easy to code

Firebase Cloud Messaging for Flutter example

In this tutorial, I will suggest the way of handling notifications after they have successfully arrived to our app. There are lots of tutorials that explain how to setup Android/iOS native part in order to receive them, which we will skip.

At the beginning, we will create a class called NotificationsManager that well be listening to notifications that are fetched via FirebaseMessaging instance:

factory NotificationsManager() {
if (_singleton == null) {
_singleton = NotificationsManager._();
}
return _singleton;
}

NotificationsManager._() {
_firebaseMessaging = FirebaseMessaging();

_onNotificationAction = StreamController.broadcast();

_startListeningNotifications();

if (Platform.isIOS) {…


Super-simple comparison for your next interview

Photo from inovex Blog.

This article will explore Flutter’s built-in solutions for state management.

In all the examples below, we’ll be changing the app background by clicking on the button:


FLUTTER INTERVIEW QUESTIONS

As almost everything in Flutter, StreamBuilder is a Widget and as you can assume - it rebuilds its UI according to the new values that are passed via Stream it listens to.

In the example below, we generate 10 random colors from periodic Timer(each second new color gets generated) and pass it to the stream. Our StreamBuilder listens to the events from provided Stream and changes Container’s background color to the newly fetched one.


FLUTTER INTERVIEW QUESTIONS

Futures are one of the most used Dart language features and it’s really important to know all the ways we can wait for fetching their results.

This is a simple async function, with a Future in it, that will finish after 3 seconds(imagine some API call or something like that):


Good luck Flutteristas!!! You can do it! :)

Preparation checklist

Flutter is relatively new technology but it gets more and more popular each day and if you check the number of available Flutter jobs worldwide, on LinkedIn for example, you can see that lots of new jobs gets posted each day.

Currently, there are 4k+ Flutter jobs available just on LinkedIn. Last year, there were few hundreds. Huge expansion for such a short period of time.

This is how I would prepare for my first Flutter interview:

1. Dart docs

If you wanna apply for the Flutter interview, you must know Dart, at least at beginners level(if you wanna do just the UI…


Why the hell setState() sometimes does not work?

…and why Flutter tries to recycle Widgets’s State?

How many times have you called setState() and nothing on the screen has changed even though the internal State of the Widget has changed?
I know I have, many times :)

Jelena Lecic

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store