Skip to content

Commit

Permalink
chore: Run dartfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
drager committed Nov 18, 2020
1 parent ce035b7 commit 462e276
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/src/data/user_agent/user_agent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ class UserAgents {

UserAgents.fromJson(Map<String, dynamic> json) {
if (json['userAgents'] != null) {
userAgents = new List<UserAgent>();
userAgents = List<UserAgent>();
json['userAgents'].forEach((v) {
userAgents.add(new UserAgent.fromJson(v));
userAgents.add(UserAgent.fromJson(v));
});
}
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
final Map<String, dynamic> data = Map<String, dynamic>();
if (this.userAgents != null) {
data['userAgents'] = this.userAgents.map((v) => v.toJson()).toList();
}
Expand Down Expand Up @@ -90,7 +90,7 @@ class UserAgent {
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
final Map<String, dynamic> data = Map<String, dynamic>();
data['folder'] = this.folder;
data['description'] = this.description;
data['userAgent'] = this.userAgent;
Expand Down
11 changes: 6 additions & 5 deletions lib/src/image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ class Image {
/// Generates a url to a image random image. The size of image is determined
/// by `width` and `height` parameters. You can choose the image categories related
/// by the `keywords` parameter separeted by comma .
///
///
/// Example:
/// ```dart
/// faker.image.image(width: 1200, height: 900, keywords: ['people', 'nature']);
/// ```
String image({int width = 640, int height = 480, List<String> keywords = const []}) {
String image(
{int width = 640, int height = 480, List<String> keywords = const []}) {
return _imageUrl(width, height, keywords);
}

Expand All @@ -21,17 +22,17 @@ class Image {
/// ```
String _imageUrl(int width, int height, List<String> keywords) {
var url = 'https://source.unsplash.com';

url += '/${width}x${height}';

if (keywords.isNotEmpty) {
var keywordFormat =
new RegExp(r'^([A-Za-z0-9].+,[A-Za-z0-9]+)$|^([A-Za-z0-9]+)$');
RegExp(r'^([A-Za-z0-9].+,[A-Za-z0-9]+)$|^([A-Za-z0-9]+)$');
if (keywords.any(keywordFormat.hasMatch)) {
url += '?' + keywords.join(',');
}
}

return url;
}
}
}

0 comments on commit 462e276

Please sign in to comment.