Flutter - Authorization with Rest API | Role Based Authorization | Part 6

Published: 07 November 2023
on channel: Online Solutions Academy
233
3

A key/value pair is an associative relationship where the key is used as an index to access a value. For example, you may have a months of the year data structure in which the key is a number and the value is derived from the number, e.g., 1 generates the month January and 12 denotes December.
In this video, you will learn how to utilize Maps and Lists within your application.
#restapis #flutter #apiintegration
Flutter provides http package to consume HTTP resources. http is a Future-based library and uses await and async features. It provides many high level methods and simplifies the development of REST based mobile applications.
Fetching data from the internet is necessary for most apps. Luckily, Dart and Flutter provide tools, such as the http package, for this type of work.
Basic Concepts
http package provides a high level class and http to do web requests.

http class provides functionality to perform all types of HTTP requests.

http methods accept a url, and additional information through Dart Map (post data, additional headers, etc.,). It requests the server and collects the response back in async/await pattern. For example, the below code reads the data from the specified url and print it in the console.

print(await http.read('https://flutter.dev/'));
Some of the core methods are as follows −

read − Request the specified url through GET method and return back the response as Future(String)

get − Request the specified url through GET method and return back the response as Future(Response). Response is a class holding the response information.

post − Request the specified url through POST method by posting the supplied data and return back the response as Future(Response)

put − Request the specified url through PUT method and return back the response as Future (Response)

head − Request the specified url through HEAD method and return back the response as Future(Response)

delete − Request the specified url through DELETE method and return back the response as Future(Response)


Watch video Flutter - Authorization with Rest API | Role Based Authorization | Part 6 online without registration, duration hours minute second in high quality. This video was added by user Online Solutions Academy 07 November 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 233 once and liked it 3 people.