flutter_faker_plus는 테스트 및 프로토타이핑을 위한 Flutter 애플리케이션용 현실적인 가짜 데이터를 생성하는 Dart 패키지입니다. 사용자 프로필, 제품 세부 정보, 지리적 위치 정보와 같은 사용자 정의 가능한 랜덤 데이터를 제공합니다. 실제 백엔드 서비스에 의존하지 않고 실제 세계 데이터셋을 시뮬레이션해야 하는 개발자에게 이상적입니다. Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 크로스플랫폼 개발에 유연하게 활용할 수 있습니다. 사용하기 쉬운 API와 적극적인 유지보수 덕분에 앱 개발 중 모크 콘텐츠 생성을 간소화합니다.
사용 사례
샘플 데이터로 UI 컴포넌트 테스트하기
현실적인 가짜 콘텐츠로 앱 프로토타이핑
랜덤 입력으로 양식 채우기
전자상거래 제품 카탈로그 시뮬레이션
테스트 사용자 계정 생성
모크 지오로케이션 데이터 생성
주요 기능
사용자 프로필 생성을 지원
제품 및 전자상거래 데이터 생성
위치 정보 및 주소 정보를 제공합니다
크로스 플랫폼 호환성
pub.dev를 통한 간편한 통합
사용자 정의 가능한 데이터 템플릿
적합한 대상
초기 프로토타이핑 단계의 플러터 개발자
일관된 가짜 데이터가 필요한 테스터
앱의 데모 버전을 만들고 있는 팀
샘플 데이터 세트가 필요한 교육 프로젝트
UI/UX 디자인 모크업 작업 중인 개발자
고려 사항
생산 데이터용이 아님
데이터는 무작위로 생성되며, 실행 간에 고유하지 않습니다
기본 설정을 초과한 사용자 정의는 제한적입니다
외부 GitHub 저장소에 의존
새로운 Flutter 버전을 위해 업데이트가 필요할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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.