http static method
A client for accessing OGC API Features
compliant sources via http(s)
conforming to format
.
The required endpoint
should refer to a base url of a feature service.
When given an optional client
is used for http requests, otherwise the
default client of the package:http/http.dart
package is used (a new
instance of default client for each service request). When client
is
given, this allows a client to better maintain persistent connections to a
service, but it's also responsibility of a caller to close it
appropriately.
When given headers
are injected to http requests as http headers
(however some can be overridden by the feature service implementation).
When given extraParams
are injected to query part of http requests
(however some can be overridden by the feature service implementation).
When format
is not given, then GeoJSON
with default settings is used
as a default. Note that currently only GeoJSON is supported, but it's
possible to inject another format implementation (or with custom
configuration) to the default one.
metaMaxAge
specifies a max age to cache metadata objects retrieved from
a service and that are cached internally (in-memory) by this client.
Implementation
static OGCFeatureService http({
required Uri endpoint,
Client? client,
Map<String, String>? headers,
Map<String, String>? extraParams,
TextReaderFormat<FeatureContent> format = GeoJSON.feature,
Duration metaMaxAge = const Duration(minutes: 15),
}) =>
_OGCFeatureClientHttp(
endpoint,
adapter: FeatureHttpAdapter(
client: client,
headers: headers,
extraParams: extraParams,
),
format: format,
metaMaxAge: metaMaxAge,
);