So you'll need to change a few things.
First you can if you want to use Appwrite flutter package (https://appwrite.io/docs/getting-started-for-flutter)
API Key
The API key let's you access Appwrite resource on a server level https://appwrite.io/docs/sdks#server
That's means that unless you have a very good reason for that you only use this key in server side code as your function.
Flutter
So, In your flutter code (App) when execution a function you should remove the X-Appwrite-key header.
Function
In your function I think that you'll need to to change the line 34 in which you're using the deleteUserFunctionId constant to delete_user_API one