패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.0.0

flutter_faker_plus

사용자 프로필, 전자상거래 제품 및 지리 위치 등에 대한 임의의 가짜 데이터를 생성합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
39
좋아요
8
Pub 점수
150

패키지 설치

flutter pub add flutter_faker_plus

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

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.

Mobile Screenshot

🚀 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.


void main() {
  WidgetsFlutterBinding.ensureInitialized();

  // Register all mock routes
  setupMockServer();

  runApp(const FakeDataApp());
}


class FakeDataApp extends StatelessWidget {
  const FakeDataApp({super.key});
  @override
  Widget build(BuildContext context) {
    // Generate fake user, product, and location data using flutter_faker_plus.
    final UserProfile user =
        UserProfile.generate(); // Generate a fake user profile.
    final EcommerceProduct product =
        EcommerceProduct.generate(); // Generate a fake e-commerce product.
    final GeoLocation location =
        GeoLocation.generate(); // Generate a fake geo-location.

    final LoremIpsum loremIpsum = LoremIpsum();
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Fake Data Generator Example'),
        ),
        body: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.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.

  1. Setup Mock Server
import 'package:flutter/material.dart';
import 'mock_server.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  setupMockServer(); // Register all mock routes

  runApp(const FakeDataApp());
}

  1. ApiService Example
import 'mock_server.dart';

class ApiService {
  final _client = MockHttpClient(mockApi);

  Future<List<Map<String, dynamic>>> getUsers() async {
    final res = await _client.request(method: HttpMethod.get, path: '/users');
    return (res.data as List).map((e) => Map<String, dynamic>.from(e)).toList();
  }

  Future<Map<String, dynamic>> createUser(Map<String, dynamic> payload) async {
    final res = await _client.request(
      method: HttpMethod.post,
      path: '/users',
      body: payload,
    );
    return Map<String, dynamic>.from(res.data);
  }
}
  1. Using Mock Requests in Widgets
final api = ApiService();

FutureBuilder<List<Map<String, dynamic>>>(
  future: api.getUsers(),
  builder: (context, snapshot) {
    if (!snapshot.hasData) return CircularProgressIndicator();
    final users = snapshot.data!;
    return ListView.builder(
      itemCount: users.length,
      itemBuilder: (_, i) {
        final u = users[i];
        return ListTile(
          title: Text(u['name'] ?? 'No Name'),
          subtitle: Text(u['email'] ?? 'noemail@domain.com'),
        );
      },
    );
  },
);
  1. Create New User
await api.createUser({
  'name': 'John Doe',
  'email': 'john.doe@example.com',
});

🛠 Installation

Add flutter_faker_plus to your pubspec.yaml file:

dependencies:
  flutter_faker_plus: ^2.0.0

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.