Last active
March 20, 2020 07:20
-
-
Save hasimyerlikaya/cb3d89dc3048529a28f5efcf2e349f51 to your computer and use it in GitHub Desktop.
You can clone dart object easily.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
factory SearchRequest.fromJson(Map<String, dynamic> json) => _$SearchRequestFromJson(json); | |
Map<String, dynamic> toJson() => _$SearchRequestToJson(this); | |
SearchRequest clone() { | |
final String jsonString = json.encode(this); | |
final jsonResponse = json.decode(jsonString); | |
return SearchRequest.fromJson(jsonResponse as Map<String, dynamic>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment