2

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

  • What happens when you execute the function using `Run test` option from functions blade in `Azure portal`? – user1672994 Feb 07 '22 at 06:27
  • No problem what happens. The function works properly. In this case, you only need to change the value of one in the database. And the function works without problems. My question is how to trigger that function using my flutter app – Mate Marić Feb 07 '22 at 13:41

1 Answers1

1

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: enter image description here

  • 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.

  • And the home component builds a scaffold and puts together a page to accept 6 attempts for words.
  • The _checkWord handler calls the wordle-api, gets the color code, and updates the components accordingly.
  • Calling the Function API in the above handler and writing the code about response status and the user-defined message to the response.

var uri = Uri.https('wordle-api.azurewebsites.net', '/api/CheckWord', params);

For Complete Code, Please refer this article.

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18