νμ
μ΄λͺ¨μ§ μ λ ₯ μ ν μ€νΈνλμμ κΈμκΈΈμ΄κ° 2μ μ΄μμΌλ‘ μ‘ν
μ΄μ
ν΄κ²°λ°©μ
Characters(text).length;
μ μ½λλ₯Ό μ΄μ©ν΄ μ½λμ λμ λ°ννλκ²μ΄ μλλΌ μ€μ νμλλ λ¬Έμ κ°μλ₯Ό λ°νν΄μΌν¨
λν ν μ€νΈνλμμ κΈμμ μ νμ λκ³ μΆμΌλ©΄ λ¨μν maxLength μμ±μ μ¬μ©νλκ²μ΄ μλλΌ μλμ inputFormatterλ₯Ό μ¬μ©ν΄μΌν¨
final maxLength = 100;
maxLengthWithEmojiFormatter(int maxLength) => [
TextInputFormatter.withFunction((oldValue, newValue) {
final count = Characters(newValue.text).length;
if (count > maxLength) {
return oldValue;
}
return newValue;
}),
];