URL-адрес firestore rest работает в браузерах, но не на мобильных устройствах - PullRequest
0 голосов
/ 19 июня 2019

Я просто ввожу стандартный URL-адрес запроса в браузерах и просто получаю ответ.это URL: https://firestore.googleapis.com/v1/projects/myproject/databases/(default)/documents/products/1ZFMrY2iw9a554Ltz6Bu

, но когда я использую его в проекте флаттера, я получаю следующий ответ:

I / флаттер (10824): I / флаттер (10824):I / flutter (10824):
Ошибка 403 (запрещено) !! 1 I / flutter (10824):

Я пишу свой код так:

Future<http.Response> Request({String inputURL,httpMethod method}) 
{

Map<String,String> headers =  
{

};

  switch (method) {

    case httpMethod.gett:
       return http.get(inputURL,headers: headers);
      break;
    case httpMethod.head:
   return http.head(inputURL,headers: headers);
      break;
    case httpMethod.post:
  return http.post(inputURL,headers: headers);
      break;
    case httpMethod.put:
       return http.put(inputURL,headers: headers);
      break;
    case httpMethod.delete:
     return http.delete(inputURL,headers: headers);
      break;
    case httpMethod.connect:
  //return http.(inputURL);
      break;
    case httpMethod.options:
     //return http.op(inputURL);
      break;
    case httpMethod.trace:
       //return http.trace(inputURL);
      break;
  }
...