AttributeError: 'Request' object has no attribute 'post'

I am try to get data from flutter to frappe doctype by post api. But get AttributeError. I don’t understant the reson. Please help me if know the solution :smiling_face_with_tear:

frappe code:

import frappe

def receive_post_data():
    data =

Flutter code:

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:http/http.dart' as http;

class Register extends StatefulWidget {
  const Register({Key? key}) : super(key: key);

  State<Register> createState() => _RegisterState();

class _RegisterState extends State<Register> {
  TextEditingController email=TextEditingController();
  TextEditingController name=TextEditingController();
  TextEditingController pass=TextEditingController();
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Resister"),
        centerTitle: true,
        padding: EdgeInsets.only(left: 28.0, right: 28.0),
        child: Column(
          children: [
            TextField(controller: email, decoration: InputDecoration(hintText: "Email"),),
            TextField(controller: name, decoration: InputDecoration(hintText: "Name"),),
            TextField(controller: pass, decoration: InputDecoration(hintText: "Password"),),
            ElevatedButton(onPressed: (){registerUser();}, child: Text("Resigter"))

  void registerUser()async{

    var url="";
    var data = {
      "name": name.text,
      "email": email.text,
      "pass": pass.text,
    var bodyy=jsonEncode(data);
    var urlParse = Uri.parse(url);
    final response= await
      body: bodyy,
      headers: {
        "Authorization": "Token 440acd4c0783e1d:aa548178410e21a",
        'Content-Type': 'application/json',
    if (response.statusCode == 200) {
      print('Data posted successfully');
    } else {
      print('Failed to post data');

This is the offending line. frappe.request is of type Request which doesn’t have the attribute post.

Either your app hasn’t set that attribute or it’s working on a false assumption. You may want to use frappe.local.form_dict, frappe.desk.reportview.get_form_params or something similar to fetch params. Although, it would be best to define your endpoint with defined named params & types (better security) like

def validate_token(token: str):