Using sessiontoken in Google Places API and flutter

  Kiến thức lập trình

I am using the Places API to fetch information about certain cities in my app.
Everything is working fine so far except for the billing view. I also use dio for the http requests.

Here is how I add the sessiontoken to my requests:

@Riverpod(keepAlive: true)
SessionTokenInterceptor sessionTokenInterceptor(
  SessionTokenInterceptorRef ref,
) {
  return SessionTokenInterceptor(ref);

class SessionTokenInterceptor extends QueuedInterceptor {

  final SessionTokenInterceptorRef ref;

  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    final withSessionToken =
    if (withSessionToken != null) {
      options.headers[GoogleMapApiConfig.sessionTokenHeaderKey] =

Via debugging I can see that the same token is used as well for place autocomplete as for place details, but I wonder if adding the sessiontoken as header instead of query parameter is recommended. The code is basically from

I asked the question because the documentation (SKU: Autocomplete (included with Place Details) – Per Session) states that when using sessiontoken, I should see something like

Autocomplete (included with Place Details

Place Details (price starting at 0.017 USD per session)

But I cannot see anything like that. I rather see

Autocomplete – Per Request

Place Details

and my bill is increasing really fast. Luckily I am still in the test phase.
I don’t know if my sessiontoken is being considered at all.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website