I was trying to add Image to Text recognition in one of my apps using google-vision package when I found out that it doesn’t perfectly work on Huawei devices (look here for more info), so I tried using ml-kit library. Unfortunately, many tutorials about using this library were either outdated or not accurate, so I thought to write a more updated tutorial on this matter.

Starter Project

After adding Firebase to our project using this link and enabling Firebase ML API, we add these dependencies required for ml-kit :

Enabling Camera

We are going to use the default external…

Have you ever watched “Catch me if you can” movie? It’s about a skilled forger who has passed as a doctor, lawyer, and pilot. An FBI agent becomes obsessed with tracking down the con man and the story continuous. A heisenbug is something like this, and in this post, we are going to get more familiar with this kind of bugs.

Based on Wikipedia a heisenbug is a software bug that seems to disappear or alter its behavior when one attempts to study it. The term is a pun on the name of Werner Heisenberg, the physicist who first asserted…

Securing API Keys In Flutter Using C++ and dart ffi

Sometimes loosing secret Api Key can create a dangerous privacy issue or may effect the billing of our app. Fortunately flutter has many ways to secure these data, and hiding our sensitive keys inside a C file may be one of the best methods we can afford. In this post we are going to hide our key inside a C function using dart:ffi library.

What is dart ffi?

Basically It’s a library to call native C APIs. FFI stands for foreign function interface. Other terms for similar functionality include native interface and language bindings.

Before our library or program can use the FFI library…

While landing on a “404 Error” is never ideal, there’s no reason that it has to be a visually unappealing experience. In this post, we are going to create a simple yet beautiful Error page for our app using PositionedTransition in Flutter. Before jumping in to the code, let’s get more familiar with the kind of animation we’re going to employ.

PositionedTransition is an animated version of Positioned which takes a specific Animation<RelativeRect> to transition the child’s position from a start position to an end position over the lifetime of the animation.

Please note: PositionedTransition only works if it’s the…

I recently watched Marcin Szałeks video about complex UI where he creates some awesome animations using flutter. In this post we are going to create one of those beautiful animations.

First lets take a look at the project structure before adding animations:


@override Widget build(BuildContext context) { return Stack( children: [ // Works as Drawer Scaffold( backgroundColor: const Color(0xff22a6b3), body:const DrawerData(), ), // Works as Main Screen Scaffold( backgroundColor:Colors.white, appBar: PreferredSize( preferredSize: Size.fromHeight(200), child: Container( color: const Color(0xffee5253), child: Padding( padding: const EdgeInsets.fromLTRB(12, 24, 12, 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ IconButton( icon: Icon(Icons.menu), ), Padding(…

We can simply change flutter app theme with BloC pattern and Shared-preferences library, however we can also achieve this goal using a BloC library extension called HydratedBloc. The hydrated_bloc package is an extension of the flutter_bloc library which automatically stores states so that they can be restored even if the app is closed and opened again later. In this tutorial we are going to create a simple app and change its theme using this library.

Default app layout

Nothing special here, just a simple app with one page:


void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is…

I wanted to create a login with google button in my app and found out that it may be a little tricky, so I thought it may be good to share the steps I took.

1- Adding dependency

First step is adding google_sign_in to our project:

google_sign_in: ^4.5.1
$ flutter pub get
dependencies {
// Add the google services classpath
classpath 'com.google.gms:google-services:4.3.0'}

In Flutter we can create Collapsing app bars just like android and iOS. In this tutorial, we are going to create an app bar with a dynamic image as its header.

Payam Asefi

Flutter developer and a nature lover. Besides coding I like playing video games, watching movies, and reading mangas.

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