Home > OS >  Json authentication request body contains a dollar sign
Json authentication request body contains a dollar sign

Time:11-11

I'm writing an http post request to access an endpoint of an api responsible for user authentication, what happens is that the documentation from the api gives an example of body request that looks like this:

{
   "serviceName": "MobileLoginSP.login",
      "requestBody": {
           "NOMUSU": {
               "$": "USUARIOTESTE"
           },
           "INTERNO":{
              "$":"123456"
           },
          "KEEPCONNECTED": {
              "$": "S"
          }
      }
  }

I couldn't find anything online about that weird dollar sign in the body request, and in the code editor it throws this error Expected an identifier.dart(missing_identifier), I'm coding a flutter app.

CodePudding user response:

Dollar($) has a special significance in Dart for string interpolation. You can use ['$'] instead of ['$'] in order to hint that this Dollar sign is not a special char.

CodePudding user response:

you have to use '$' to recognize as String, you can read more about it here in official flutter documentation.

  • Related