カテゴリー・パッケージ・リポジトリを検索

パッケージ詳細v2.0.1

mock_data

Dartを使用してランダムなデータを生成します。ランダムな文字列、整数、名前、色、IPアドレス、UUID、URL、日付を作成するために使用できます。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
2290
いいね数
29
Pub ポイント
160

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

flutter pub add mock_data

パッケージ概要

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

mock_data パッケージは Dartでランダムかつ現実的なテストデータを生成します。ランダムな文字列、整数、名前、色、IPアドレス、UUID、URL、日付を作成するためのユーティリティを提供し、開発やテスト中に現実世界のデータをシミュレートするのに最適です。このパッケージは軽量で簡単に統合でき、Android、iOS、Web、macOS、Windows、Linuxなどすべての主要プラットフォームをサポートしています。UIにプレースホルダー内容を埋め込むことや、外部ソースに依存せずにデータ処理ロジックをテストする場合に特に役立ちます。

用途

  • サンプルデータでUIプロトタイプを埋める
  • データ解析および表示ロジックのテスト
  • 偽のユーザープロフィールの作成
  • API応答のシミュレーション
  • ランダムなテストデータセットの作成
  • ダミー入力を使用してフォームを埋める

主な機能

  • 複数のデータ型(文字列、数値、日付など)をサポートしています
  • クロスプラットフォーム互換性
  • シンプルで直感的な API
  • 現実的な見た目の値を生成します
  • Flutter pubを介した簡単な統合
  • 外部の依存関係なし

適している対象

  • モックアップを作成する開発者
  • ランダムな入力を必要とするテスト担当者
  • プロトタイプアプリを開発するチーム
  • フロントエンド開発者がUIをプロトタイピングしています
  • 素早い偽データが必要な誰もが

注意事項

  • 本番データの生成には適していません
  • 乱数は暗号的に安全とは限らない
  • 特定のフォーマット用のカスタマイズオプションが限られている
  • 標準では複雑なデータ構造をサポートしていません
  • 開発・テスト環境でのみ使用することをお勧めします

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Mock Data Logo
Build Status License Version
Generate random data using Dart

Features

API provides generation of:

  • Integers in any range of numbers
  • Strings with various characters and length
  • Colors represented with needed color space
  • Dates between different moments in time
  • Names such as John or Mary
  • UUIDv4 and Timestamp-first UUIDs
  • URLs with many fragments
  • IPv4 and IPv6
  • Locations as either random points or in specified radius

Usage

A simple usage example:

import 'package:mock_data/mock_data.dart';

main() {

  mockName();           // Generate male or female first name. 
  mockName('male');     // Generate male first name. 
  mockName('female');   // Generate female first name. 

  mockInteger(1, 6);    // Generate integer in range from 1 do 6.

  mockString(16);       // Generate string of length 16.
  
  mockIPv4();           // Generate IPv4 represented with 
                        // format(default is '*.*.*.*') as String. 
  
  mockIPv6();           // Generate IPv6, same usage as with IPv4.

  mockColor('hex');     // Generate color represented in hex format.
  mockColor('rgb');     // Generate color represented in RGB format.
  
  mockUUID();           // Generate UUIDv4
  
  mockLocation();       // Generate random location.
  mockLocation(53.55, 108.14, 1000); // Generate random location in 1000 m radius from the specified coordinates.
  
}

These are some basic examples. There are many more methods and they all support tweeking of parameters to suit you in generating random data. By reading examples you can learn more about functionality and usage of mock_data

Contributors
License

MIT

カテゴリー

ソースリポジトリ

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