Aus öffentlichen Paketdaten erstellte Orientierung.
flutter_faker_plus ist ein Dart-Paket, das realistische Fakedaten für Tests und Prototypen von Flutter-Anwendungen generiert. Es bietet anpassbare zufällige Daten wie Benutzerprofile, Produktinformationen und Geolokalisierungsdaten. Ideal für Entwickler, die echte Datensätze simulieren müssen, ohne auf echte Backend-Dienste angewiesen zu sein. Das Paket unterstützt mehrere Plattformen wie Android, iOS, Web, macOS, Windows und Linux und ist somit vielseitig für plattformübergreifende Entwicklung geeignet. Mit einer einfach zu verwendenden API und aktiver Pflege erleichtert es die Erstellung von Mock-Inhalten während der App-Entwicklung.
Anwendungsfälle
UI-Komponenten mit Beispiel-Daten testen
Apps mit realistischen Dummy-Inhalten prototypisch erstellen
Formulare mit zufälligen Eingaben füllen
Simulation von E-Commerce-Produktkatalogen
Testbenutzerkonten erstellen
Mock-Geolokationsdaten erstellen
Hauptmerkmale
Unterstützt die Benutzerprofilgenerierung
Generiert Produkt- und E-Commerce-Daten
Bietet Geolokalisierungs- und Adressinformationen
Plattformübergreifende Kompatibilität
Einfache Integration über pub.dev
Anpassbare Datenmodelle
Geeignet für
Flutter-Entwickler im frühen Prototyping-Stadium
Tester, die konsistente Dummy-Daten benötigen
Teams, die Demo-Versionen von Apps erstellen
Bildungsprojekte, die Stichproben-Datensätze erfordern
Entwickler, die an UI/UX-Design-Mockups arbeiten
Hinweise
Nicht für Produktionsdaten vorgesehen
Daten werden zufällig generiert und sind bei verschiedenen Ausführungen nicht eindeutig
Eingeschränkte Anpassungsmöglichkeiten jenseits der grundlegenden Einstellungen
Abhängig von externem GitHub-Repository
Könnte Aktualisierungen für neue Flutter-Versionen erfordern
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
flutter_faker_plus
A comprehensive fake data generator for Flutter/Dart applications.
🚀 Features
User Profiles: Generate random user profiles with:
Name
Email
Phone number
Address
Date of birth
Gender
Profile picture URL
Bio
E-commerce Products: Create random product data including:
Product name
Price
Category
Geolocation: Generate random latitude and longitude coordinates.
Lorem Ipsum: Added Lorem Ipsum placeholder text.
Future Plans:
Add image URLs for e-commerce products.
Support additional fake data types.
Implement a fake QR code generator.
Flutter Faker Data Generator Example
This example demonstrates how to generate fake user, product, and location data using the flutter_faker_plus library in Flutter.
voidmain() {
WidgetsFlutterBinding.ensureInitialized();
// Register all mock routessetupMockServer();
runApp(constFakeDataApp());
}
classFakeDataAppextendsStatelessWidget{
constFakeDataApp({super.key});
@overrideWidgetbuild(BuildContext context) {
// Generate fake user, product, and location data using flutter_faker_plus.finalUserProfile user =
UserProfile.generate(); // Generate a fake user profile.finalEcommerceProduct product =
EcommerceProduct.generate(); // Generate a fake e-commerce product.finalGeoLocation location =
GeoLocation.generate(); // Generate a fake geo-location.finalLoremIpsum loremIpsum = LoremIpsum();
returnMaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Fake Data Generator Example'),
),
body: SingleChildScrollView(
child: Padding(
padding: constEdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('User Profile:', style: TextStyle(fontSize: 20)),
// Displays a heading for the user profile section.Text('Name: ${user.name}'),
// Displays the generated user's name.Text('Email: ${user.email}'),
// Displays the generated user's email.Text('Phone: ${user.phoneNumber}'),
// Displays the generated user's phone number.Text('Address: ${user.address}'),
// Displays the generated user's address.Text('Date of Birth: ${user.dateOfBirth}'),
// Displays the generated user's date of birth.Text('Gender: ${user.gender}'),
// Displays the generated user's gender.Image.network(user.profilePictureUrl),
// Displays the user's profile picture from a network URL.Text('Bio: ${user.bio}'),
// Displays the generated user's bio.SizedBox(height: 20),
// Adds vertical spacing of 20 pixels.Text('E-Commerce Product:', style: TextStyle(fontSize: 20)),
// Displays a heading for the product section.Text('Product: ${product.name}'),
// Displays the product name.Text('Category: ${product.category}'),
// Displays the product category.Text('Price: \$${product.price}'),
// Displays the product price prefixed with a dollar sign.SizedBox(height: 20),
// Adds vertical spacing of 20 pixels.Text('Geo-Location:', style: TextStyle(fontSize: 20)),
// Displays a heading for the geo-location section.Text('Latitude: ${location.latitude}'),
// Displays the generated latitude.Text('Longitude: ${location.longitude}'),
// Displays the generated longitude.SizedBox(height: 20),
// Adds vertical spacing of 20 pixels.Text('Lorem Ipsum:', style: TextStyle(fontSize: 20)),
Text(
loremIpsum.generate(words: 20),
),
SizedBox(height: 5),
Text(
loremIpsum.generate(
words: 60, paragraphs: 3, showLoremIpsum: true),
),
SizedBox(
height: 600,
child: UserPage())
],
),
),
),
),
);
}
}
🧪 Mock API Requests
flutter_faker_plus comes with a mock backend server for testing without a real API.