분류, 패키지 및 저장소 검색

패키지 상세v2.0.1

mock_data

Dart를 사용하여 임의의 데이터를 생성합니다. 임의의 문자열, 정수, 이름, 색상, IP 주소, UUID, URL 및 날짜를 생성하는 데 사용할 수 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
2.3천
좋아요
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

카테고리

소스 저장소

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