我仍在学习使用 NewsAPI.org 创建一个新闻应用程序,它正在工作,只是立刻给了我这个错误:
DioError [DioErrorType.response]: Http status error [429]
I/flutter (11270): #0 DioMixin.assureDioError (package:dio/src/dio_mixin.dart:819:20)
I/flutter (11270): #1 DioMixin._dispatchRequest (package:dio/src/dio_mixin.dart:678:13)
I/flutter (11270): <asynchronous suspension>
I/flutter (11270): #2 DioMixin.fetch.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart)
I/flutter (11270): <asynchronous suspension>
I/flutter (11270): NoSuchMethodError: The getter 'data' was called on null.
I/flutter (11270): Receiver: null
I/flutter (11270): Tried calling: data
答案 0 :(得分:0)
HTTP 429 表示您发送的请求过多。您可以通过减少请求来修复它,也可以在请求之间添加一些延迟。为此,您可以为此使用 Future 延迟或 Timer 函数。