I created an azure function in c # and set up an HTTP trigger. I'm interested in how to call this function from the flutter application. I don't need to transfer any special data because everything is already in the link I use to call the function.I’ve created a simplified view of the function to demonstrate what I want.
https://functionapp220220124204147.azurewebsites.net/api/Quercus?status=Off
When it calls this function all it needs to do is change the value of the variable from on to off
I know this is not the correct way to make a function and I should not have such variables, but this is just a simplified version
Here is a workaround given by Vikash Kumar in the Medium article regarding How to call Azure Functions API through Flutter App Code:
Created Wordle
Website which has a list of legit words and allows you to input a word only from that list where we validate if an input word is a legit English word.
First, he created the Azure Cosmos DB > container in it > added a few dates, word pairs like:
Created the Azure Functions which has input binding with the Cosmos DB
and gets a list of stored words on every request.
This functionality is broken into 3 segments:
Validate the input word (not null, same length, convert to uppercase both)
Check if both words are the same
Status of each letter in the input word.
The deployed function app API will be in this format: https://wordle-api.azurewebsites.net/api/CheckWord?word=
Also created the flutter in the composition of the word_field
component which creates an input widget that accepts a 5 letter word in 5 boxes (1 each) which is similar to the OTP field.
home component
builds a scaffold and puts together a page to accept 6 attempts for words._checkWord
handler calls the wordle-api
, gets the color code, and updates the components accordingly.var uri = Uri.https('wordle-api.azurewebsites.net', '/api/CheckWord', params);
For Complete Code, Please refer this article.