Python转Dart
从Python翻译到Dart。源文件可以在[这里](https://github.com/btwq97/ee4002d-fyp)查看。
安装依赖
- 安装AWS DynamoDB SDK (版本 1.0.0)
flutter pub add aws_dynamodb_api
- 安装Dart Decimal包 (版本 2.1.0)
flutter pub add decimal
- 安装flutter_blue包 (版本 0.8.0)。可能需要管理员权限。
flutter pub add flutter_blue
- 安装mqtt_client包 (版本 9.6.3)
flutter pub add mqtt_client
- 安装flutter_dotenv (版本 5.0.2)
flutter pub add flutter_dotenv
其他所需依赖
-
DynamoDB
要求
- 已安装JRE。
- 在此[下载本地DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html)。
- 解压文件。
运行数据库
- 在本地运行db实例。
java -D"java.library.path=./DynamoDBLocal_lib" -jar DynamoDBLocal.jar -sharedDb测试连接
- 运行命令
aws dynamodb list-tables --endpoint-url https://:8000学习
- 在此[阅读更多](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Python.html)。
-
Mosquitto
安装指南
- 已在Ubuntu 20.04上测试。
- 在此[阅读更多](https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-ubuntu-18-04)。
启动Mosquitto
- 运行
mosquitto- 查看已发布的MQTT消息
mosquitto_sub -h localhost -t "<insert topic>" -u "<insert username>" -P "<insert password>"
测试
- 运行Flutter应用程序。
flutter run