mirror of
https://github.com/rrousselGit/riverpod.git
synced 2025-08-15 02:06:53 +08:00

<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated dependency configurations to allow greater flexibility and removed an obsolete linting tool. - **Refactor** - Streamlined state management and theme handling to improve maintainability without impacting visible functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
import 'package:dio/dio.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
part 'common.g.dart';
|
|
|
|
final client = Provider((ref) => Dio());
|
|
|
|
/// A Provider that exposes the current theme.
|
|
///
|
|
/// This is unimplemented by default, and will be overridden inside [MaterialApp]
|
|
/// with the current theme obtained using a [BuildContext].
|
|
@Riverpod(
|
|
// Specifying an empty "dependencies" signals riverpod_lint that this provider
|
|
// is scoped. This enables catching places where we need to override
|
|
// this provider.
|
|
dependencies: [],
|
|
)
|
|
ThemeData theme(Ref ref) {
|
|
throw UnimplementedError();
|
|
}
|
|
|
|
class TimestampParser implements JsonConverter<DateTime, int> {
|
|
const TimestampParser();
|
|
|
|
@override
|
|
DateTime fromJson(int json) {
|
|
return DateTime.fromMillisecondsSinceEpoch(
|
|
json * 1000,
|
|
isUtc: true,
|
|
);
|
|
}
|
|
|
|
@override
|
|
int toJson(DateTime object) => object.millisecondsSinceEpoch;
|
|
}
|