在 Flutter 中将数字格式化为字符串

Format a number to string in Flutter

我已经使用 intl_phone_field 包在 Flutter 中使用 phone 数字输入构建了一个注册系统。现在我必须将此数字格式化为字符串以将其填充到数据库中。有什么办法可以做到这一点。我找不到任何相关内容。

感谢您的帮助。

您是否按照文档中的描述使用 completeNumber getter?

IntlPhoneField(
    decoration: InputDecoration(
        labelText: 'Phone Number',
        border: OutlineInputBorder(
            borderSide: BorderSide(),
        ),
    ),
    initialCountryCode: 'IN',
    onChanged: (phone) {
        print(phone.completeNumber);
    },
)