Skip to main content

simple_https_service 3.0.0 copy "simple_https_service: ^3.0.0" to clipboard
simple_https_service: ^3.0.0 copied to clipboard

A package for simple HTTPS communication with timing control and response handling.

3.0.0 - 2026-10-23 #

  • BREAKING: CertificatePinner now rejects certificates outside their validity period (expired or not yet valid) by default. The device clock is used for this check. To keep the previous behavior, pass checkValidity: false to fromPem / fromBytes / fromAsset.
  • Added DER support with automatic format detection (PEM / DER):
    • Added CertificatePinner.fromBytes and UtilSecurityContext.fromBytes.
    • CertificatePinner.fromAsset and UtilSecurityContext.fromAsset now accept both PEM and DER files.
  • Updated README for the above changes.

2.1.0 - 2026-10-22 #

  • Added securityContext parameter to all POST methods of HttpsServiceForNative (post, customPost, postBytes, postMultipart). It is passed to HttpClient(context: ...).
  • Added UtilSecurityContext (Native only): creates a SecurityContext that trusts certificates from PEM (fromPem / fromAsset). Normal TLS verification (including host name and expiry) is still performed. This is the recommended way to trust a self-signed certificate.
  • Added CertificatePinner (Native only): certificate pinning for badCertificateCallback, for cases where the certificate's SAN cannot be fixed (e.g. the server's IP changes).
    • CertificatePinner.fromPem / CertificatePinner.fromAsset create a pinner from PEM. Multiple certificates in one PEM are all trusted.
    • check returns true only when the server certificate exactly matches one of the trusted certificates.
  • Updated README with guidance on choosing between the two methods.

2.0.1 - 2026-09-01 #

  • Improved documentation and usage guidelines for badCertificateCallback across HttpsServiceForNative:
    • Clarified the doc comments for badCertificateCallback to explicitly describe its return value behavior (true to accept, false to reject) and added security warnings regarding unconditional approval.
    • Updated README with safer usage examples (e.g., restricting bad certificate bypass to kDebugMode) and clearer formatting for parameter descriptions.

2.0.0 - 2026-05-15 #

  • Added CancelToken: a caller-driven cancellation token that can be shared across multiple in-flight requests. Calling cancel() aborts every request currently using the token by closing the underlying http.Client, and also interrupts any pending TimingManager wait or exponential-backoff delay. (How Client.close() aborts the in-flight request is delegated to the http package and the platform; this package does not depend on any particular underlying transport.)
  • Added EnumServerResponseStatus.cancelled and UtilServerResponse.cancelled() so cancelled requests can be distinguished from real failures in UI / error reporting paths.
  • All POST methods on HttpsService and HttpsServiceForNative (post, customPost, postBytes, postMultipart) now accept an optional cancelToken parameter.
  • BREAKING: EnumServerResponseStatus gained a new value (cancelled). Any exhaustive switch on the enum will need an additional case.
  • Internal: HttpsService no longer uses the http.post() / http.send() static helpers and instead manages an http.Client per attempt so it can be closed to abort an in-flight request. No behavior change for callers that do not use cancellation.

1.1.0 - 2026-05-15 #

  • Added postBytes for sending raw binary payloads with a custom Content-Type (defaults to application/octet-stream).
  • Added postMultipart for sending multipart/form-data with text fields and binary files. Only byte input is supported via the new MultipartFileSpec class to keep retries safe and the API simple.
  • MultipartFileSpec supports an optional contentType (e.g. "image/png") so each part can carry its own MIME type. When omitted, the multipart default application/octet-stream is used.
  • Both new methods are available on HttpsService and HttpsServiceForNative and share the same timing/retry/response handling as post / customPost.
  • Added http_parser (already a transitive dependency of http) to dependencies so per-part contentType strings can be parsed via MediaType.parse.
  • Internal: extracted the retry + timing + response formatting loop into a private helper (lib/src/network/post_runner.dart) to remove duplication between HttpsService and HttpsServiceForNative. No behavior change for existing methods.

1.0.0 - 2026-05-02 #

  • Initial release.
  • HttpsService: HTTPS POST for web and native platforms.
  • HttpsServiceForNative: HTTPS POST for native platforms with self-signed certificate support.
  • TimingManager: Singleton for controlling request intervals.
  • RetryConfig: Singleton for configuring automatic retry with exponential backoff and jitter.
  • ServerResponse: Unified response object with categorized status.
  • EnumServerResponseStatus: Response status enum (success, timeout, serverError, otherError, signInRequired).
  • EnumServerResponseType: Response body format enum (json, byte, text).
  • EnumPostEncodeType: POST encoding type enum (urlEncoded, json).
  • UtilCheckURL: Utility for HTTPS URL validation.
  • UtilServerResponse: Factory utility for creating ServerResponse objects.
0
likes
160
points
109
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A package for simple HTTPS communication with timing control and response handling.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter, http, http_parser, web

More

Packages that depend on simple_https_service