This file contains hidden or 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
| import 'package:equatable/equatable.dart'; | |
| abstract class CompanyEvent extends Equatable { | |
| const CompanyEvent(); | |
| @override | |
| List<Object> get props => []; | |
| } | |
| class FetchCompanies extends CompanyEvent {} |
This file contains hidden or 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
| import 'package:pinjollist/repository/company_api_provider.dart'; | |
| import 'package:pinjollist/model/company.dart'; | |
| class CompanyRepository { | |
| CompanyApiProvider _apiProvider = CompanyApiProvider(); | |
| Future<CompaniesResponse> getCompanies() { | |
| return _apiProvider.getCompanies(); | |
| } | |
| } |
This file contains hidden or 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
| import 'dart:async'; | |
| import 'package:dio/dio.dart'; | |
| class LoggingInterceptors extends Interceptor { | |
| @override | |
| Future<FutureOr> onRequest(RequestOptions options) async { | |
| print( | |
| "--> ${options.method != null ? options.method.toUpperCase() : 'METHOD'} ${"" + (options.baseUrl ?? "") + (options.path ?? "")}"); | |
| print("Headers:"); |
This file contains hidden or 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
| import 'package:dio/dio.dart'; | |
| import 'package:pinjollist/model/company.dart'; | |
| import 'package:pinjollist/utils/logging_interceptors.dart'; | |
| class CompanyApiProvider { | |
| Dio get dio => _dio(); | |
| Dio _dio() { | |
| final options = BaseOptions( | |
| baseUrl: "https://pinjollist.now.sh/api/", | |
| connectTimeout: 5000, |
This file contains hidden or 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
| import 'package:json_annotation/json_annotation.dart'; | |
| part 'company.g.dart'; | |
| @JsonSerializable() | |
| class CompaniesResponse { | |
| CompaniesResponse(this.status, this.data); | |
| final String status; | |
| final List<Company> data; |
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| // This widget is the root of your application. | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Flutter Demo', |
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| // This widget is the root of your application. | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Flutter Demo', |
This file contains hidden or 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
| import UIKit | |
| let name = "Ihwan" | |
| var age = 17 | |
| var isHungry: Bool = false | |
| let 🇮🇩: String = "Indonesia 🇮🇩" | |
| var height: Float = 168.0; | |
| print("Hi All \nmy name is \(name)! \ni'm from \(🇮🇩)") | |
| print("my name consists of \(name.count) characters") |
This file contains hidden or 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
| void main() { | |
| printStatus(Status.Start); | |
| } | |
| enum Status{ | |
| Start, | |
| OnGoing, | |
| Finish | |
| } |
This file contains hidden or 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
| void main() { | |
| List<int> numbers = [1, 2, 3, 4, 5]; | |
| print(total(numbers)); | |
| print(combine(numbers)); | |
| } | |
| int total(List<int> value){ | |
| int i = 0; | |
| int result = 0; |