Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

Najib Ghozy Mustofa ghozay19

🌴
On vacation
Block or report user

Report or block ghozay19

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View detail_screen.dart
import 'package:flutter/material.dart';
import 'package:movie_db/core/model/movie_item.dart';
class DetailScreen extends StatefulWidget {
/// Code dibawah ini merupakan tanda bahwa DetailScreen membutuhkan parameter
/// movieItem, hasil lemparan dari page sebelumnya.
MovieItem movieItem;
DetailScreen({this.movieItem});
View home_screen.dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:movie_db/core/model/movie_resp.dart';
import 'package:movie_db/core/service/service.dart';
import 'package:movie_db/ui/detail_screen.dart';
class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
View service.dart
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:movie_db/core/model/movie_resp.dart';
class Service {
String nowPlayingUrl =
'https://api.themoviedb.org/3/movie/now_playing?api_key=MASUKANAPIKEYKAMUDISINI&language=en-US&page=1&region=ID';
String upComingUrl =
'https://api.themoviedb.org/3/movie/upcoming?api_key=MASUKANAPIKEYKAMUDISINI&language=en-US&page=1';
@ghozay19
ghozay19 / movie_resp.g.dart
Created Feb 16, 2020
hasil generate movie_resp
View movie_resp.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'movie_resp.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
MovieResp _$MovieRespFromJson(Map<String, dynamic> json) {
return MovieResp(
View movie_resp.dart
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.
@ghozay19
ghozay19 / movie_item.g.dart
Created Feb 16, 2020
hasil generate movie_item
View movie_item.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'movie_item.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
MovieItem _$MovieItemFromJson(Map<String, dynamic> json) {
return MovieItem(
View movie_item.dart
import 'package:json_annotation/json_annotation.dart';
part'movie_item.g.dart';
@JsonSerializable()
class MovieItem {
@JsonKey(name: 'poster_path')
String posterPath;
You can’t perform that action at this time.