ComposeUiTextFlags


Flags that guard new code paths in this module. These flags are on by default. Apps can turn them off if a new path causes a bug.

These flags are short-term. Do not rely on them staying around. If turning a flag off fixes a bug, please file an issue right away.

Usage:

In a debug build, set a flag to false as early as possible when the app starts. Changing it after Compose text code loads can cause bugs.

class MyApplication : Application() {
    override fun onCreate() {
        ComposeUiTextFlags.isPackedTextStylesEnabled = false
        super.onCreate()
    }
}

In a release build, R8 rules can also lock the flag for the whole build. This lets R8 strip the unused code path from the app.

-assumevalues class androidx.compose.ui.text.ComposeUiTextFlags {
    public static boolean isPackedTextStylesEnabled return false
}

Summary

Public properties

Boolean

When true, SpanStyle, ParagraphStyle, TextStyle, and AnnotatedString use a compact memory format.

Cmn

Public properties

isPackedTextStylesEnabled

var isPackedTextStylesEnabled: Boolean

When true, SpanStyle, ParagraphStyle, TextStyle, and AnnotatedString use a compact memory format. When false, these classes use their old format.

Do not mix objects built before and after changing this flag. Set this flag in Application.onCreate before any TextStyle, SpanStyle, ParagraphStyle, or AnnotatedString is used.