パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.0.0

flutter_faker_plus

ユーザーのプロフィール、EC製品、地理的位置などに対してランダムな偽データを生成します。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
39
いいね数
8
Pub ポイント
150

パッケージをインストール

flutter pub add flutter_faker_plus

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

flutter_faker_plus は、Flutter アプリケーションのテストおよびプロトタイピングに使用する現実的な偽データを生成するためのDartパッケージです。ユーザープロフィール、製品詳細、位置情報などのカスタマイズ可能なランダムデータを提供します。実際のバックエンドサービスに依存せずに、現実世界のデータセットをシミュレートしたい開発者に最適です。Android、iOS、Web、macOS、Windows、Linuxなど複数のプラットフォームをサポートしており、クロスプラットフォーム開発に非常に柔軟です。使いやすく、積極的にメンテナンスされているため、アプリ開発中のモックコンテンツ作成を効率化します。

用途

  • サンプルデータを使用してUIコンポーネントをテストする
  • 現実的なダミー コンテンツを使用したアプリのプロトタイピング
  • ランダムな入力でフォームを埋める
  • eコマース製品カタログのシミュレーション
  • テストユーザー アカウントの生成
  • モックジオロケーションデータの作成

主な機能

  • ユーザープロファイルの生成をサポート
  • 製品および電子商取引データを生成します
  • 位置情報と住所情報を提供します
  • クロスプラットフォーム互換性
  • pub.dev を通じた簡単な統合
  • カスタマイズ可能なデータテンプレート

適している対象

  • 初期段階のプロトタイピングにおけるFlutter開発者
  • 一貫したダミーデータが必要なテスト担当者
  • アプリのデモ版を構築しているチーム
  • サンプルデータセットを必要とする教育プロジェクト
  • 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 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。