title: Http Post Flutter to SAP
body: <p>Im trying to use http post to transfer data from flutter to SAP. I can get data without any problem, but post attempt is failing with code 403 (x-csrf-token invalid)</p>
  <p>I had the same problem while working in C# but that was resolved using event handler, that triggers just before save (please see below extract of C# code) but i'm unable to find option in flutter. Please guide..</p>
  <pre><code>   zZSSALE1SRVEntity.SendingRequest2 += new EventHandler&lt;SendingRequest2EventArgs&gt;(_container_SendingRequest_Enhance);
     zZSSALE1SRVEntity.SaveChanges();
  
     private void _container_SendingRequest_Enhance(object sender, SendingRequest2EventArgs e)
      {
          HttpWebResponse response;
          string empty = string.Empty;
          string str = string.Empty;
          CookieContainer cookieContainer = new CookieContainer();
          OdataSsaleDEV.ZZSSALE1_SRV_Entities zZSSALE1SRVEntity = new OdataSsaleDEV.ZZSSALE1_SRV_Entities(app_uri)
          {
              Credentials = credentials
          };
          string str1 ;
          if (empty == string.Empty)
          {
              HttpWebRequest credentials = (HttpWebRequest)WebRequest.Create(zZSSALE1SRVEntity.BaseUri);
              credentials.Method = &quot;GET&quot;;
              credentials.Headers.Add(&quot;X-CSRF-Token&quot;, &quot;Fetch&quot;);
              credentials.Credentials = zZSSALE1SRVEntity.Credentials;
              cookieContainer = new CookieContainer();
              credentials.CookieContainer = cookieContainer;
              try
              {
                  response = (HttpWebResponse)credentials.GetResponse();
              }
              catch (WebException webException)
              {
                  MessageBox.Show(webException.Message);
                  return;
              }
              catch (Exception exception)
              {
                  MessageBox.Show(exception.Message);
                  return;
              }
              empty = response.Headers.Get(&quot;X-CSRF-Token&quot;);
              str = response.Headers.Get(&quot;Set-Cookie&quot;);
              credentials.Abort();
          }
          if (empty != string.Empty)
          {
              e.RequestMessage.SetHeader(&quot;x-csrf-token&quot;, empty);
              foreach (Cookie cooky in cookieContainer.GetCookies(zZSSALE1SRVEntity.BaseUri))
              {
                  str1 = string.Concat(str1, &quot;;&quot;, cooky.ToString());
              }
              e.RequestMessage.SetHeader(&quot;Cookie&quot;, str1.Substring(1));
          }
  </code></pre>