'Flutter using woff2 as custom font

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.



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amir Mohammad Shams