Flutter and Android Development

So after some install minor trouble in IntelliJ due to minor bugs in the Flutter Dart plugin, the system works quite nice. Hot reloads are the best. There are however some issues. Like the following.

  1. The produced files are multi-megabyte resource hogs. This may just be the debug version, but even with building production APK, not having JDK 8 options in pro-guard, a simple 1 page GUI hits 6 MB. (Be careful of libraries).
  2. There is little configure-ability in the default demo project. Things like default used SD card for install and other sensible options, mean trips into the Android base code and XML more often than should be necessary. (I can’t edit my MainActivity.java with source highlights and error locations).
  3. The state-container split is weird, especially as all the sub-containers are in the state. I do like the templating though in IntelliJ. (The documentation on preserving state is scarce).
  4. Generic functions are nice, and so is some of the library support. There are still a few inconsistencies, but these should iron out over time.
  5. I’m about to discover the GC of PaintRecorder panic on my graphical reserves. I assume this is making GL shaders in the background.
//looks different now, ... The package dart:ui has issues!!<br />//and a duplicate Image, Rect, ... classes
  void atlasUsing(SmartCanvas sc) {
    sc.drawRawAtlas(hi, _transforms,
        _getCharacterRect(),
        Int32List colors,
        BlendMode.srcOver,//should check for mixing foreground and background
        CanvasManager.unit,
        sc.normalPaint);
  }

A bit of work later, and the dart analyser does not crash as often. I think it really is important to not go too low level without some knowledge. The classes collide, and it is best to import dart:ui as an as (I picked ‘Hood’ for under the hood), so as to avoid many of the issues. This does mean that I will have to abstract many of the functions of the low level to be easy functions working with high level (non Hood) Paint, Rect and others. But it was a fun journey!

The channel interface to native is quite an interesting journey as well. It has all the memories of Java and switching back from dart, some things are missed. I’m using the Android platform to generate some sound in the current project. There is not too much in the way of basics to play sound files in the Flutter libraries. Custom AudioTrack stuff is a definite return to Java and a MethodChannel.

The next thing is some code to put the sound together, and some code to add in some convenience methods for putting animation on the CanvasWidget I’ve put together. The IntelliJ dart analyser keeps failing but is restartable after a bit of editing. The code is quite simple for many tasks. There is some complexity when dealing with Future<X>, which infects its way up the stack, needing some setState() for eventually filling in the data on the future resolution. You’d have thought that a¬†return¬†await would have resolved and made the async wait for a resolved future. Because, the documentation is unclear on many things.

It’s not a perfect language isn’t dart, but it is quite nice to use. Flutter is actually very good. I’d suggest ScopedModel and quite a few of the better packages to be included in most projects you’d make.

Kindle Fire (Pt. III)

A general complaint about Android devices is that when you’re low on power, and it always wants to switch on and waste it rather than wait until you press the on button. It’s part of the global always on spy network, designed for idiots with money and not for intelligent or off-grid people. Alexa likely wants to know your inside leg measurement. As I said this is general to all Android devices, so I suppose expecting more from Amazon was just too much.

I suppose it would be too much to edit things like the above equation on the device, but I will try to see if there is such an equation editing tool. Plenty of good calculators, but few typographical tools. I sometimes would like to do this. It’s not as though I need the mathematical assistance, more typographical layout, for including in documents.

It seems there is nothing which will do this offline. Maybe an app opportunity? Likely a long development. It depends on other tools such as MathML being hack-able into something else. Of course n=k in the above equation. A bit of maths in the “analytic closure of integration” to make it a deterministic process for a CAS (Computer Algebra System). It replaces integration (hard for computers to pattern match, and based on a large and incomplete knowledge base) with simultaneous equations and factorization.

There seem to be some downloaded episodes of some series happened this morning. Three free episodes (Number 1) of some random TV shows. I assume this is to get people into watching exciting stuff. I feel a bandwidth suck in the making. Ah, so it’s called “On Deck“, and although kind of interesting, it would be nice to make it only use certain WiFi networks. While on 4G hotspot proxy, it will make my bank account sad.

Amazon Kindle Fire 7″ (Minus Ads) + Raspbian PC

Well, they say it’s in the post. It should arrive before Christmas. This review will get longer as I test it out. I had to get the 8GB version as the lack of adverts was something that was essential. Maybe I’ll get better use of PDFs, and free up quite some space on my mobile by not needing all the document apps on it. I just wonder how much “junk” is installed by default, and how much can’t be disabled. Exciting! Alexa, swear like a sailor!

Quick side notes: I’m replacing my Debian by Raspbian Desktop for PC (Ooooooh). It’s going to be the standard OS of Linux in the company. Just updating the development with node, fpc and git. Along with httpd2, mariadb-server and php.

More gigs of android updates this morning. Why can’t android developers trim their code? The tools are available, but they seem not to be used, and the insistance of stuffing apps with excessive graphical resources continues. How many gig for a texting app?

So it was a little weird. First make sure you have plenty of data, as it will do a system update within a few hours. Get all the apps you can find off the AmazonStore (after you sign in) and be aware that not all the ones you want will be found. Then enable side loading of apps, and get the four needed .apk files for google store. Install these in the correct order, and open play store. Sign in. Get the play apps you want.

A note on compatibility. Microsoft Outlook will required Chrome to use gmail. The play store may try to download updates for some of your apps. This is OK, but some will give errors. This can be divided into 3 groups.

  1. Things like LinkedIn – Likely using a strange hack but it does work.
  2. Kindle app – Play store tries to update and fails, it needs setting to not automatic update in the play store (on the menu of the app listing in the store). This then seems to disappear after the firmware update.
  3. Things like Whatsapp – Just not compatible as there is no phone device.

Luckily the Fire does not try to auto-update apps which were sideloaded (or downloaded from play store). It tells you this in the library updates section, so don’t be tempted to enter update fight hell. This could be problematic. Some notes on the options I chose to ignore on the first setup.

  1. Ignore the Amazon, Facebook and Twitter integration. I mean you could try it, but I haven’t, as the play store apps work just fine.
  2. You must enable sideloading. This can be a problem later if you don’t understand the implication of downloading a .apk file. Remember the play store is the guest store, and so needs sideloading to work. But any random internet site could have a downloadable with bad intent.
  3. Alexa seems to want to work, but she hasn’t said anything yet. Maybe I’m just doing it wrong. This is the most likely option.

After a bit of connection to ADB, it looks like the Alexa service uses about 10% of the processor power just waiting for the word “Alexa”, which is a bit extreme for me. Gag ‘Lexa, oh yes!