Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass RandomGenerator in private in the specific generator. #66

Open
lsaudon opened this issue Nov 10, 2022 · 0 comments
Open

Pass RandomGenerator in private in the specific generator. #66

lsaudon opened this issue Nov 10, 2022 · 0 comments

Comments

@lsaudon
Copy link
Contributor

lsaudon commented Nov 10, 2022

RandomGenerator is public in all generator.
Is this what is intended?

So we can do as below, which seems illogical to me.
faker.color.random.decimal();

import 'data/colors/colors.dart';
import 'random_generator.dart';

class Color {
  const Color(this.random);

  final RandomGenerator random;

  /// Generates a color name.
  ///
  /// Example:
  /// ```dart
  ///   faker.colors.color();
  /// ```
  String color() => random.element(allColors);

  /// Generates a color name from a smaller list of colors.
  ///
  /// Example:
  /// ```dart
  ///   faker.colors.commonColor();
  /// ```
  String commonColor() => random.element(commonColors);
}

This will be a breaking change, but it is possible to modify it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant