Skip to content

Instantly share code, notes, and snippets.

@ghozay19
Created February 16, 2020 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghozay19/e4fd1db88a3abc2a07f8b78bd4a0bc0a to your computer and use it in GitHub Desktop.
Save ghozay19/e4fd1db88a3abc2a07f8b78bd4a0bc0a to your computer and use it in GitHub Desktop.
movie_resp
import 'package:json_annotation/json_annotation.dart';
import 'package:movie_db/core/model/movie_item.dart';
part'movie_resp.g.dart';
@JsonSerializable()
class MovieResp {
List<MovieItem> results;
//samakan tulisan results ini dengan response json yang terdapat di apinya.
//kode diatas akan me-list movie item yang sudah kita buat.
MovieResp(this.results);
factory MovieResp.fromJson(Map<String, dynamic> json) => _$MovieRespFromJson(json);
Map<String, dynamic> toJson() => _$MovieRespToJson(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment