copyWith method

DataSource copyWith({
  1. String? dataKey,
  2. FakerXLocale? locale,
  3. List<Format>? formats,
  4. List<String>? values,
  5. Function? builder,
})

Implementation

DataSource copyWith({
  String? dataKey,
  FakerXLocale? locale,
  List<Format>? formats,
  List<String>? values,
  Function? builder,
}) {
  if (this is StringDataSource) {
    return (this as StringDataSource)._copyWith(
      dataKey: dataKey,
      locale: locale,
      formats: formats,
      values: values,
      builder: builder,
    );
  } else if (this is TypeDataSource) {
    return (this as TypeDataSource)._copyWith(
      dataKey: dataKey,
      locale: locale,
      values: values,
      builder: builder,
    );
  }
  throw Exception('could not clone the DataSource, Unknown Type');
}