newsdataapi 0.0.1
newsdataapi: ^0.0.1 copied to clipboard
Official Dart/Flutter client (SDK) for the Newsdata.io News API: typed methods for real-time, historical, crypto, and stock-market news with validation, retries, pagination, and typed errors.
Changelog #
0.0.1 #
Initial release.
NewsDataApiClientwith typed named-parameter methods for all 8 endpoints (latest,archive,crypto,sources,market,count,cryptoCount,marketCount).- Client-side parameter validation (mutually-exclusive groups,
sentiment_scorerequiressentiment,size1–50,from_date/to_daterequired on count endpoints,rawQueryparsing). - Typed exception hierarchy:
NewsdataException→NewsdataValidationException,NewsdataApiException(→NewsdataAuthException,NewsdataRateLimitException,NewsdataServerException),NewsdataNetworkException. - Retries with exponential backoff and
Retry-Afterparsing (integer seconds + HTTP-date). - Two pagination helpers:
scrollAll(merged) andpaginate(Stream<NewsdataResponse>). - Configurable
http.Clientinjection, request timeout, and optional logger callback (API key is redacted in logged URLs). - Typed
Articledeserialization with all server fields including AI enrichments (aiTag,aiRegion,aiOrg,sentiment,sentimentStats). - 34 unit tests using
package:http/testingmocks — no network needed. - Compatible with Dart 3.0+ and Flutter 3.0+; works on iOS, Android, Web, and Desktop in pure Dart with no platform channels.