Sunday, September 19, 2021

How to restart the app with flutter Android and iOS

Hi all, welcome back to my blog. And today lesson is about flutter again. I have a little problem when trying to resart the app directly from the app. So what I mean is I want to restart the app after users do something. Because if I don't do it, the app flow will be bad and the data that I want to refresh will be failed.

So in my use case in my app is I want to restart the app after user sign in or sign out in my app. The reason is I need to restart all of the previous state. That's the easy way I can do, and I have some problems with camera plugin.

The problem is happened only on android, so when you click sign in google/facebook, there'll be new page native from their sdk and making the app in inactive status. That'll will make camera bug, and it will make the app crash.

Saturday, August 21, 2021

Using Android Device as Daily Function Calling API

Hi guys, it's a august month, I really want to share something worth today. I found an unique idea for my issue. This is about notification daily that's in Food Today app that I usually do it manually. Before I usually push notification about food holiday everyday. But the time when I pushed it. It's random not always exact time.

Then suddenly in my mind I think I can make it automatically pushing notification without third party like firebase function that now I have. I had it for backup data firebase in other project every week one time. Because you know it's quite expensive for me to do it daily. So I made it only once a week and so far I satisified.

And as you know in Android we can do periodic using AndroidAlarmManager you can check here https://pub.dev/packages/android_alarm_manager_plus. And I combine it with firebase notification so at spesific time 5:00 am everyday. And so far It always call the firebase notif. If you're curious about this app you can download it on Foodtoday.ungapps.com. Feel free to try and rate it.

Saturday, July 31, 2021

Fix Warning Debug Symbols in Play Store with Flutter Android

 


Hi all, This post was written at the end of july, tomorrow is august. So It's luck I have an issue that I can share with you guys. For this post I want to share about warning that I usually ignore in play store. After I uploaded the appbundle and see the warning message. 

You can just ignore it because it's just a warning. No neccessary to do, but it will be nice if we can solve it. So it'll be benefit for analysis in debug. That's was written in picture above, for me I haven't got experiences what will make app for analyses. Maybe I will update it later.

Ok first thing you need to do is installing NDK in Android Studio if you already have it, just skip installing session. To install it you can go to tools->sdk manager->sdk tools tab. And the select NDK and CMake then install it.


Sunday, June 27, 2021

Upgrade My Projects to Flutter 2.0 Experience And It Suprises Me

Hi all, this post I'm gonna share what I encounter when upgrading the project to flutter. Especially this app Food Today. That's been around 1 years in App Store and Play Store. The app helps people to capture moment with their daily foods so they can control it as food diary. Other than that there's food holiday everyday that will inspire you to eat what foods for today. Still a lot of features that you can get. Just try it.

I have an issue on iOS where I need to update my pod file to make platform :ios, '11.0'. Before It's 9.0, I think now 9.0 is deprecated and we can't use it anymore for the next updated plugin. Like I used a lot firebase feature. And so thare are coding adjusment that will break your code that you need to read the their docs. But usually there's error message in console about proper way to solve it.

Now like snackbar from flutter need to be changed according to the new one, https://flutter.dev/docs/release/breaking-changes/scaffold-messenger. Fortunely there's a doc from flutter to update it. For my self it's not hard to update the changes, but more like time consuming to replace it one by one. But for better app we need to transform it. So it's no problem in the end. We use it free lol.

Thursday, May 13, 2021

Customize Error Widget App Flutter

Today is holiday Eid Mubarak in Indonesia. So Having much time to spend with family and hobby. And I want to say Eid Mubarak. And What I'm gonna share this today it's simple. It's related with ui widget error that we often face when something wrong with our ui widget. It could be like returning null inside BuildContext. Like screenshot above, I accidentally made the error but it could be real error next time lol.

So what the production build handle this kind of error ? It just show empty white screen. And this is what we want to customize it. It's better if we we show error message and one button to reset the app. So the user experience will be much better. 

Fortunetly the implementation is not hard to do. You just need to implement ErrorWidget.builder in main class with your error custom widget. As example below that I create. You can create your own class to customize the UI. Don't forget you need to pass one parameter to your class that's FlutterErrorDetails. 

Sunday, April 25, 2021

Plugin formz Helps Flutter Bloc Cubit to Make State

One of my projects using latest flutter bloc with cubit. And I follow tutorial from flutter bloc web. And First time I learned it, it made me confused why so many classes do we have to implement it. Like Event class, Bloc class and State class. And The view itself have two things ui page and form page. It's like we have five classes to cover bloc and flutter ui.

But After using it a little big long, I can see why we need to have many classes. First if your app is not big, it will make your code looks too much. Sorry I forget the word that can explain it better. But if your app is big and continue developing. It will be easir for you to maintain it.

So what I'm gonna share this month, about the one of the core flutter bloc plugin that I used for my app. That is formz. It's not just used for flutter bloc only, you can combine it with other state management. So what's the advantage using this plugin is you can simplify and clarify the input form page like making validation and loading state when submitting form.

So if you have form in your app, it must has input and button to submit, right ? So for one input, you need to define it in formz class. So in that class, you need to use @override method that is validator. I give you en example below. It uses many term like pure or dirty. To indicate the value inside FormzInput. This is for string value that is Name itself.

Sunday, March 21, 2021

Automatic Backup Firestore Using Cloud Scheduler Every Day



Doesn't feel it's been a month since I posted last article regarding print using printer bluetooth. The app has been used over one month and It's fine. I haven't had problem but maybe the alignment that doesn't fit right and left doesn't sync. But overrall it's good for my sister business.

If you've firebase firestore for a long time. Maybe you wonder if your data is lost and there's something upredictable happened. We want our data save, but we believe firebase can handle it right. But for the best you need to backup your data to prevent something bad happened. Fortunely firebase supports it with Google Cloud Platform it's possible. 

There are many article that talks about it, even firebase has documentation about it that I'm gonna the link below. It's not hard to do but remember you need to pay to do it. In my case It doesn't cost much because my DB is small I think. It's a few hundreds Kb. So it's still acceptable in my wallet lol. For now I do backup for 24 hours following practice in firebase.

Saturday, February 20, 2021

Printing Receipt with Blutetooth Using Flutter

Recently, I bought the bluetooth printer for my sister business. She wants to have receipt everytime clients have done treatment. It's beauty care business. So She needs the customer database and transactions as well. So I made the app first to record all of it. The problem I have is I have never used bluetooth printer before for my projects. Because I don't have one to try.

Fortunately I got one to test the printer. First I need to search the plugin that supports printer bluetooth on Flutter. Because I made the app for iOS and Android. So I need the cross platform framework that is flutter. That I think it's powerful. OK the plugin that I used is esc_pos_bluetooth. It's not easy acuallty to use. Because I have problem using android that I need to fork the repository.

The issue related to android permissions on newest android phone. That the library haven't updated yet, but many people have known the issues. So there are two packages that I fork. It's esc_pos_bluetooth and flutter_bluetooth_basic. I explain what I need these two packages. First with flutter_bluetooth_basic I added two permissions.

Sunday, January 17, 2021

Show searchable_dropdown Widget Without Using Dropdown But Button


Hello guys, My first post for this year and today I'm gonna show you how to use searchable_dropdown package when they only show the searchble_dropdown through dropdown, but actually if you look closer inside the package you can find DropdownDialog which is you can implement ShowDialog to show it without using Dropdown.

In this useful package, you don't need to implement your own search because it's provided by the package. You only need to provide the data to the widget. That's what I like about this plugin or package. It's very useful because I used this for my app Food Today where the use can search food categories using this plugin and there's textfield where you can type the category you want to show.

As you can see on the video above where I click search button then showing searchable dialog. It's not hard to do luckily. First of course you need to install the package searchble_dropdown in pubspec.yaml and don't forget to do "flutter pub get" in terminal before using the package in your code.