This commit is contained in:
austinried
2023-04-28 09:24:51 +09:00
parent 35b037f66c
commit f0f812e66a
402 changed files with 34368 additions and 62769 deletions

24
lib/http/client.dart Normal file
View File

@@ -0,0 +1,24 @@
import 'package:http/http.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'client.g.dart';
const Map<String, String> subtracksHeaders = {
'user-agent': 'subtracks/android',
};
class SubtracksHttpClient extends BaseClient {
SubtracksHttpClient();
@override
Future<StreamedResponse> send(BaseRequest request) {
request.headers.addAll(subtracksHeaders);
print('${request.method} ${request.url}');
return request.send();
}
}
@Riverpod(keepAlive: true)
BaseClient httpClient(HttpClientRef ref) {
return SubtracksHttpClient();
}

23
lib/http/client.g.dart Normal file
View File

@@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'client.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$httpClientHash() => r'78f604dbc249a854728d71bde8289d48f6700be7';
/// See also [httpClient].
@ProviderFor(httpClient)
final httpClientProvider = Provider<BaseClient>.internal(
httpClient,
name: r'httpClientProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$httpClientHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef HttpClientRef = ProviderRef<BaseClient>;
// ignore_for_file: unnecessary_raw_strings, subtype_of_sealed_class, invalid_use_of_internal_member, do_not_use_environment, prefer_const_constructors, public_member_api_docs, avoid_private_typedef_functions