在Flutter中进行开发,您想向用户发送短信。这是使用Twilio软件包发送短信的方法。
答案 0 :(得分:3)
将HTTP包添加到您的pubspec.yml import os
path = os.getcwd()
filenames = os.listdir(path)
for filename in filenames:
os.rename(filename, filename.replace("_", "").replace("_ ", ""))
导入'package:http / http.dart'为http;
http: ^0.12.1
验证:
http.Response _sendSms = await http.post('https://[ACCOUNT_SID]:[AUTH_TOKEN]@api.twilio.com/2010-04-01/Accounts/[ACCOUNT_SID]/Messages.json', body: {'Body': 'You have a user contact us message from app. SUBJECT: "${_subjectController.text}"', 'From': '[TWILLIO_NUMBER]', 'To': '[RECIPIENT_NUMBER]'});