【问题标题】:Synchronize sending data to the server, whether there is internet or not in Flutter同步发送数据到服务器,Flutter 中是否有网络
【发布时间】:2022-04-24 17:58:59
【问题描述】:

我正在尝试在我的应用程序中添加时间特性,这样如果有互联网,数据就会在应用程序中发送,而在没有互联网的情况下,我会保留它,然后在有互联网的情况下发送它是互联网。这件事我该怎么办,使用http或dio的首选库是什么

【问题讨论】:

  • 您可以使用shared preferences 包来存储您在没有互联网时需要发送的数据。然后,如果用户上线,则触发将存储的数据发送到服务器。使用任何人 http 或 dio
  • 请问有什么例子吗

标签: flutter http dart caching dio


【解决方案1】:

我使用 dio_http_cache: 插件,它适用于我,但最好的解决方案是 sqflite 或 hive

【讨论】:

    猜你喜欢
    • 2012-03-06
    • 1970-01-01
    • 2020-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-17
    相关资源
    最近更新 更多