我正在尝试将短信发送到固定电话号码,但无法正常工作。当我在android studio中的虚拟设备中运行代码时,没有问题,但是当人们在游戏商店中下载该应用程序时,它在方括号[]中显示了收件人,这使得收件人在某些手机中无法识别,因此该应用程序不会t发送短信。该应用程序用于预约发廊,但我没有使用数据库。谢谢。 (如您所见,我尝试使用.replace,但这没用)
List<String> p=[
'12345678',
'11223344',
];
class HairsalonConfirm extends StatelessWidget {
String x, n, d, t, ty, no;
void _sendSMS(String message, List<String> recipents) async {
String _result =
await FlutterSms.sendS
MS(message: message, recipients: recipents);
_message = _result;
}
HairsalonConfirm(
{@required this.x, this.n, this.no, this.t, this.d, this.ty});
@override
Widget build(BuildContext context) {
return Scaffold(
...// other code
const SizedBox(height: 40),
Padding(
padding: const EdgeInsets.only(left: 15, right: 15),
child: Center(
child: Container(
width: 280.0,
height: 50.0,
child: RaisedButton(
onPressed: () {
_sendSMS(x, [p[8].replaceAll('[', '').replaceAll(']', '').trim()]);
NameController.clear();
timeCtl.clear();
dateCtl.clear();
TypeController.clear();
NotesController.clear();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
MyHomePage()));
},
...//some code