drager/faker

Pass RandomGenerator in private in the specific generator.

lsaudon opened this issue · 0 comments

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.