초기 커밋
This commit is contained in:
20
lib/shared/models/api_response.dart
Normal file
20
lib/shared/models/api_response.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'api_response.freezed.dart';
|
||||
part 'api_response.g.dart';
|
||||
|
||||
@Freezed(genericArgumentFactories: true)
|
||||
class ApiResponse<T> with _$ApiResponse<T> {
|
||||
const factory ApiResponse({
|
||||
required bool success,
|
||||
required T data,
|
||||
String? message,
|
||||
@Default(200) int statusCode,
|
||||
}) = _ApiResponse<T>;
|
||||
|
||||
factory ApiResponse.fromJson(
|
||||
Map<String, dynamic> json,
|
||||
T Function(Object?) fromJsonT,
|
||||
) =>
|
||||
_$ApiResponseFromJson(json, fromJsonT);
|
||||
}
|
||||
Reference in New Issue
Block a user