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
Future<http.Response> shareEvent(clipId) async { | |
final response = await http.post( | |
'https://api.songclip.com/events/share', | |
headers: { | |
HttpHeaders.authorizationHeader: authHeader, | |
"apikey": apikey, | |
}, | |
body: jsonEncode(<String, Object>{ | |
'sourcePlatform': 'iOS', | |
'sessionId': 'U7BMARUXDWNY', |
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
{ | |
"status": "success", | |
"data": { | |
"context": { | |
"sessionId": "BTGK6GIG46EF" | |
}, | |
"validationErrors": [ | |
{ | |
"msg": "Must provide a valid uniqueId to identify the user!", | |
"field": "context.uniqueId" |
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
{ | |
"status": "success", | |
"data": { | |
"context": { | |
"uniqueId": "d35ef6f6ee1b", | |
"sessionId": "BSY06BSYMXL" | |
} | |
} | |
} |
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
Future<Response> playEvent(clipId) { | |
return http.post( | |
'https://api.songclip.com/events/play', | |
headers: { | |
HttpHeaders.authorizationHeader: authHeader, | |
"apikey": apikey, | |
}, | |
body: jsonEncode(<String, Object>{ | |
'sourcePlatform': 'iOS', | |
'sessionId': 'U7BMARUXDWNY', |
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
Future<List<Clip>> fetchClips() async { | |
List<Clip> clips = []; | |
final response = await http.get( | |
"https://api.songclip.com/songclips/?q=love&shuffle=true&page=1&limit=20&minLength=10&maxLength=300", | |
headers: { | |
HttpHeaders.authorizationHeader: authHeader, | |
"apikey": apikey, | |
}, | |
); |
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 'dart:convert'; | |
import 'dart:io'; | |
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
import 'package:http/http.dart'; | |
import 'package:fluttertoast/fluttertoast.dart'; | |
/* |
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'; | |
import 'bloc.dart'; | |
typedef UpdateShouldNotify<T> = bool Function(T bloc, _BlocProvider oldWidget); | |
class BlocProvider<T extends Bloc> extends StatefulWidget { | |
final T bloc; | |
final Widget child; | |
final UpdateShouldNotify<T> updateShouldNotifyOverride; |