Julwrites Stuff

Learning Flutter by improving an Open Source LLM Chatbot


Learning Flutter by improving an Open Source LLM Chatbot

I’ve been saying I want to learn Flutter for years now, and so far my forays into it have been short and not entirely fruitful. So I enlisted some of my juniors at work to brainstorm some ideas for me to work on, and kind of figured out a roadmap for how I would learn Flutter through projects that I’m actually interested in building.

The first project will inevitably be something not very novel, but that’s exactly the point. I want to try working on something that others have already figured out, and just focus on a specific improvement to it. In this case, I found out that Llama.cpp runs on Android, but the open source repository that has achieved this has stopped development as a proof of concept.

So, I figured, I can start with improving their UI.

Setting up the Flutter Project

Obviously, things were kind of out of date, so I had to run a couple of dart fix --apply and dart pub upgrade and flutter pub upgrade and so on before making any changes to configuration or code. And then once VS Code had stopped complaining about outdated packages or incompatibilities, it started complaining about signing.

I had to google this. I’m not very familiar with codesigning on anything other than MacOS, but the concepts were not too far off. Essentially I needed the JRE to get a keytool utility, with which I could generate a key using something like the following command:

keytool -genkey -v -keystore PATH/key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias DEVELOPERNAME

This prompts a couple times for some information, including a keystore password and a key password, which we’ll refer to as KEYSTOREPASS and KEYPASS shortly.

Then plug in the values into a key.properties file at the root of the android folder of my Flutter app (remember, Flutter is a cross-platform framework, so it has a folder in the root just for android), which looks something like this:

storePassword=KEYSTOREPASS
keyPassword=KEYPASS
keyAlias=DEVELOPERNAME
storeFile=PATH/key.jks

In this case, I also copied the key.jks into android/app for simplicity.

NOTE: Both of these files should not be pushed to git (in case it wasn’t obvious, that would be a security leak)

I also had to update the android/app/build.gradle configuration to change some key names so that it would match the names in key.properties, but that is for my own sanity.

Trying out Sherpa