This Flutter project is a simple app to fetch and display a list of users from the Random User API. It includes an interface to show user details such as profile picture, name, and email. This project was created by following a YouTube tutorial.
- Fetches user data from an API
- Displays user data in a list format
- Shows user's profile picture, full name, and email in a
ListTilewidget - Supports user model mapping from API JSON response
- Flutter SDK
- An IDE like VS Code or Android Studio
- Clone the repository.
git clone <repository-url>
- Navigate to the project directory.
cd hello-world-flutter - Install dependencies.
flutter pub get
To run the app, connect a device or start an emulator, then use:
flutter run- HomeScreen: The main screen displaying a list of users fetched from the API.
- User API Service: Handles the HTTP requests and JSON decoding.
- User Model: Defines the user structure and mappings for JSON data.
- A
StatefulWidgetthat initializes and displays a list of users. - Uses
ListView.builderto display each user in aListTilewith a circular profile picture, name, and email.
- Contains a method
fetchUserswhich makes an HTTP GET request to the Random User API. - Converts JSON response into a list of
Userobjects.
- Represents the user data structure with fields like
gender,email,phone,name, andpicture. fromMapfactory constructor is used to parse JSON data into aUserobject.
- http: Used for making network requests.
- material: Core Flutter library for UI components.
To add dependencies, include them in pubspec.yaml:
dependencies:
flutter:
sdk: flutter
http: ^0.15.0 # or latest versionThis project uses the Random User API to generate random user data. The API URL used is:
https://randomuser.me/api/?results=100