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)
Смотрите видео Flutter - Authorization with Rest API | Role Based Authorization | Part 6 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Online Solutions Academy 07 Ноябрь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 233 раз и оно понравилось 3 людям.