> ## Documentation Index
> Fetch the complete documentation index at: https://starrycodes.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# ExtendGenerator - Instant Mock Data

> Static utilities for generating random colors, UUIDs, mock credit cards, and stream-based data for rapid prototyping and testing.

{/* ### 🧬 Mock Data & Utilities */}

{/* ```dart ExtendGenerator icon="database" lines wrap */}

{/* final id = ExtendGenerator.uuid; */}

{/* final visaCard = ExtendGenerator.randomCreditCard(); */}

{/* final priceStream = ExtendGenerator.streamOf<double>( */}

{/* ); */}

{/* </Card> */}

<Steps titleSize="h3">
  <Step title="🌊 Stream Utilities">
    <ResponseField name="streamOf<T>({T Function(int index) generator, int count, Duration interval})" type="Stream<T>">
      <Expandable title="Parameters">
        <ParamField body="generator" type="T Function(int index)" required>
          A function that creates a single item of type `T`. The index is passed for sequential generation.
        </ParamField>

        <ParamField body="count" type="int" default="10">
          The total number of `items` to `emit`.
        </ParamField>

        <ParamField body="interval" type="Duration" default="Duration(seconds: 1)">
          The `delay` between emitting each item.
        </ParamField>
      </Expandable>

      Simulates a live `stream` of data that `emits` up to `count` items with a specified `interval` between each emission. Ideal for testing `StreamBuilder` widgets.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      // Generates 5 items, emitted every 500 milliseconds.
      final priceStream = ExtendGenerator.streamOf<double>(
        (i) => 100.0 + i * 0.5,
        count: 5,
        interval: 500.milliseconds,
      );
      ```
    </ResponseField>

    <ResponseField name="weightedBool(double chance)" type="bool">
      <Expandable title="Parameters">
        <ParamField body="chance" type="double" required>
          A function that creates a single item of type `T`. The index is passed for sequential generation.
        </ParamField>
      </Expandable>

      Returns `true` based on a specific probability `chance` (`0.0` to `1.0`). Used for simulating real-world scenarios like transient network errors.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      // Returns true approximately 15% of the time
      final shouldFail = ExtendGenerator.weightedBool(0.15);
      ```
    </ResponseField>
  </Step>

  <Step title="🆔 Identifiers & Finance">
    <ResponseField name="uuid" type="String">
      Generates a Mock UUID (v4 format). Sufficient for UI testing and unique keys, but not cryptographically secure.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final mockId = ExtendGenerator.uuid;
      // e.g., "a1b2c3d4-e5f6-7890-1234-567890abcdef"
      ```

      <Warning>
        The generated keys are **NOT** cryptographically secure.
      </Warning>
    </ResponseField>

    <ResponseField name="randomCreditCard({CardType type})" type="String">
      <Expandable title="Parameters">
        <ParamField body="type" type="CardType" default="CardType.visa">
          The type of card to generate (`Visa`, `Mastercard`, `Amex`, `Discover`).
        </ParamField>
      </Expandable>

      Generates a mock credit card number that is valid according to the Luhn checksum algorithm. Ideal for testing form validation logic.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final visaCard = ExtendGenerator.randomCreditCard(type: CardType.visa);
      ```
    </ResponseField>
  </Step>

  <Step title="📅 Time & Date">
    <ResponseField name="randomDate({int daysBack})" type="DateTime">
      <Expandable title="Parameters">
        <ParamField body="daysBack" type="int" default="365">
          The maximum number of days into the past the date can be.
        </ParamField>
      </Expandable>

      Generates a random `DateTime` within the past `daysBack` (default 365 days). Useful for mock user data or post timestamps.

      ```dart ExtendGenerator icon="database" lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final postDate = ExtendGenerator.randomDate(daysBack: 30);
      ```
    </ResponseField>
  </Step>

  <Step title="🎨 General Data">
    <ResponseField name="randomColor" type="Color">
      Generates a random, fully opaque (`alpha=255`) color. Ideal for visual debugging and distinguishing containers.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      Container(color: ExtendGenerator.randomColor);
      ```
    </ResponseField>

    <ResponseField name="randomEmail" type="String">
      Generates a mock email address using a random username and common domain names.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final email = ExtendGenerator.randomEmail; // e.g., "a8jkld7d@gmail.com"
      ```
    </ResponseField>

    <ResponseField name="clipboardData" type="Future<String?>" post={["async"]}>
      Retrieves the current text content from the system clipboard.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final contents = await ExtendGenerator.clipboardData;
      ```
    </ResponseField>
  </Step>
</Steps>
