Flutter using woff2 as custom font

1.3k views Asked by At

I have flutter mobile app that use a lot of font files (more that 100 MB) ..

I am using this function to load the custom font:

https://api.flutter.dev/flutter/dart-ui/loadFontFromList.html

I am trying to use woff2 format instead of ttf, it will save a lot of storage-space ..

But since flutter doesn't support woff2 ..

I am trying to load woff2 bytes, then convert it to ttf bytes before passing the bytes to loadFontFromList function

So is there any library or solution to covert woff2 bytes to ttf bytes.

1

There are 1 answers

0
Amir Mohammad Shams On

I believe it is a little bit complex, You can do it in the native environment of android with Ndk https://developer.android.com/ndk, https://github.com/google/woff2 and make the bridge with the flutter platform to transfer the woff2 file to the flutter environment.