Remove TaskStatus enum and related extensions, refactor BoardService and BoardResponse models for improved API integration, and update BoardViewModel to handle card movements between columns. Adjust UI components to reflect these changes and enhance error handling for card operations.
This commit is contained in:
@@ -7,7 +7,17 @@ class BoardRepository {
|
||||
BoardRepository({required BoardService boardService})
|
||||
: _boardService = boardService;
|
||||
|
||||
Future<Result<BoardResponse>> getBoard() async {
|
||||
return _boardService.getBoard();
|
||||
Future<Result<BoardResponse>> getBoard() => _boardService.getBoard();
|
||||
|
||||
Future<Result<MoveCardResponse>> moveCard({
|
||||
required String cardId,
|
||||
required String columnId,
|
||||
required int newOrder,
|
||||
}) {
|
||||
return _boardService.moveCard(
|
||||
cardId: cardId,
|
||||
columnId: columnId,
|
||||
newOrder: newOrder,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import '../../../core/network/network_manager.dart';
|
||||
import '../../core/config/app_config.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import '../../core/network/network_manager.dart';
|
||||
import '../../core/utils/result.dart';
|
||||
import 'model/board_response/board_response.dart';
|
||||
|
||||
@@ -9,72 +10,45 @@ class BoardService {
|
||||
|
||||
final NetworkManager _networkManager;
|
||||
|
||||
static const _basePath = '/admin/v1/kanban/kanban';
|
||||
|
||||
Future<Result<BoardResponse>> getBoard() async {
|
||||
final uri = '${AppConfig.apiBaseUrl}/api/v1/board';
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
return _networkManager.makeRequest(
|
||||
'$_basePath/boards/default',
|
||||
(json) => BoardResponse.fromJson(json),
|
||||
method: 'GET',
|
||||
);
|
||||
}
|
||||
|
||||
// final result = await _networkManager.makeRequest(
|
||||
// uri,
|
||||
// (json) => BoardResponse.fromJson(json),
|
||||
// method: 'GET',
|
||||
// );
|
||||
// return result;
|
||||
|
||||
return Result.ok(
|
||||
BoardResponse(
|
||||
success: true,
|
||||
message: 'Board data fetched successfully',
|
||||
data: tasks,
|
||||
error: null,
|
||||
),
|
||||
Future<Result<MoveCardResponse>> moveCard({
|
||||
required String cardId,
|
||||
required String columnId,
|
||||
required int newOrder,
|
||||
}) async {
|
||||
final body = jsonEncode({
|
||||
'card_id': cardId,
|
||||
'column_id': columnId,
|
||||
'new_order': newOrder,
|
||||
});
|
||||
return _networkManager.makeRequest(
|
||||
'$_basePath/cards/move',
|
||||
(json) => MoveCardResponse.fromJson(json),
|
||||
method: 'PUT',
|
||||
data: body,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
List<BoardData> tasks = [
|
||||
BoardData(
|
||||
id: '1',
|
||||
description:
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
deadline: DateTime(2025, 6, 15),
|
||||
assignedTo: 'Pratyush Tewari',
|
||||
isReady: false,
|
||||
status: 'toDo',
|
||||
),
|
||||
BoardData(
|
||||
id: '2',
|
||||
description:
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
deadline: DateTime(2025, 6, 15),
|
||||
assignedTo: 'Pratyush Tewari',
|
||||
isReady: true,
|
||||
status: 'toDo',
|
||||
),
|
||||
BoardData(
|
||||
id: '3',
|
||||
description:
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
deadline: DateTime(2025, 6, 15),
|
||||
assignedTo: 'Pratyush Tewari',
|
||||
isReady: false,
|
||||
status: 'inProgress',
|
||||
),
|
||||
BoardData(
|
||||
id: '4',
|
||||
description:
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
deadline: DateTime(2025, 6, 15),
|
||||
assignedTo: 'Pratyush Tewari',
|
||||
isReady: true,
|
||||
status: 'inProgress',
|
||||
),
|
||||
BoardData(
|
||||
id: '5',
|
||||
description:
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
|
||||
deadline: DateTime(2025, 6, 15),
|
||||
assignedTo: 'Pratyush Tewari',
|
||||
isReady: false,
|
||||
status: 'done',
|
||||
),
|
||||
];
|
||||
class MoveCardResponse {
|
||||
MoveCardResponse({required this.success, required this.message});
|
||||
|
||||
final bool? success;
|
||||
final String? message;
|
||||
|
||||
factory MoveCardResponse.fromJson(Map<String, dynamic> json) {
|
||||
return MoveCardResponse(
|
||||
success: json['success'] as bool?,
|
||||
message: json['message'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,229 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../../../core/utils/date_utils.dart';
|
||||
import '../error/error_model.dart';
|
||||
|
||||
part 'board_response.freezed.dart';
|
||||
part 'board_response.g.dart';
|
||||
class BoardResponse {
|
||||
BoardResponse({
|
||||
required this.success,
|
||||
required this.message,
|
||||
required this.data,
|
||||
required this.error,
|
||||
});
|
||||
|
||||
@freezed
|
||||
abstract class BoardResponse with _$BoardResponse {
|
||||
const factory BoardResponse({
|
||||
required bool? success,
|
||||
required String? message,
|
||||
required List<BoardData>? data,
|
||||
required ErrorModel? error,
|
||||
}) = _BoardResponse;
|
||||
final bool? success;
|
||||
final String? message;
|
||||
final BoardDetailData? data;
|
||||
final ErrorModel? error;
|
||||
|
||||
factory BoardResponse.fromJson(Map<String, Object?> json) =>
|
||||
_$BoardResponseFromJson(json);
|
||||
factory BoardResponse.fromJson(Map<String, dynamic> json) {
|
||||
final dataJson = json['data'];
|
||||
final errorJson = json['error'];
|
||||
return BoardResponse(
|
||||
success: json['success'] as bool?,
|
||||
message: json['message'] as String?,
|
||||
data:
|
||||
dataJson is Map<String, dynamic>
|
||||
? BoardDetailData.fromJson(dataJson)
|
||||
: null,
|
||||
error:
|
||||
errorJson is Map<String, dynamic>
|
||||
? ErrorModel.fromJson(errorJson)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class BoardData with _$BoardData {
|
||||
const factory BoardData({
|
||||
required String? id,
|
||||
required String? description,
|
||||
required DateTime? deadline,
|
||||
required String? assignedTo,
|
||||
required bool? isReady,
|
||||
required String? status,
|
||||
}) = _BoardData;
|
||||
class BoardDetailData {
|
||||
BoardDetailData({required this.board});
|
||||
|
||||
factory BoardData.fromJson(Map<String, Object?> json) =>
|
||||
_$BoardDataFromJson(json);
|
||||
final Board? board;
|
||||
|
||||
factory BoardDetailData.fromJson(Map<String, dynamic> json) {
|
||||
final boardJson = json['board'];
|
||||
return BoardDetailData(
|
||||
board:
|
||||
boardJson is Map<String, dynamic> ? Board.fromJson(boardJson) : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Board {
|
||||
Board({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.description,
|
||||
required this.columns,
|
||||
required this.isDefault,
|
||||
required this.userId,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
final String? id;
|
||||
final String? name;
|
||||
final String? description;
|
||||
final List<BoardColumn> columns;
|
||||
final bool? isDefault;
|
||||
final String? userId;
|
||||
final int? createdAt;
|
||||
final int? updatedAt;
|
||||
|
||||
factory Board.fromJson(Map<String, dynamic> json) {
|
||||
final columnsJson = json['columns'];
|
||||
return Board(
|
||||
id: json['id'] as String?,
|
||||
name: json['name'] as String?,
|
||||
description: json['description'] as String?,
|
||||
columns:
|
||||
columnsJson is List
|
||||
? columnsJson
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(BoardColumn.fromJson)
|
||||
.toList()
|
||||
: <BoardColumn>[],
|
||||
isDefault: json['is_default'] as bool?,
|
||||
userId: json['user_id'] as String?,
|
||||
createdAt: unixTimestampFromJson(json['created_at']),
|
||||
updatedAt: unixTimestampFromJson(json['updated_at']),
|
||||
);
|
||||
}
|
||||
|
||||
Board copyWith({List<BoardColumn>? columns}) {
|
||||
return Board(
|
||||
id: id,
|
||||
name: name,
|
||||
description: description,
|
||||
columns: columns ?? this.columns,
|
||||
isDefault: isDefault,
|
||||
userId: userId,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BoardColumn {
|
||||
BoardColumn({
|
||||
required this.id,
|
||||
required this.boardId,
|
||||
required this.name,
|
||||
required this.order,
|
||||
required this.color,
|
||||
required this.limit,
|
||||
required this.cards,
|
||||
required this.cardCount,
|
||||
required this.isOverLimit,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
final String? id;
|
||||
final String? boardId;
|
||||
final String? name;
|
||||
final int? order;
|
||||
final String? color;
|
||||
final int? limit;
|
||||
final List<BoardCard> cards;
|
||||
final int? cardCount;
|
||||
final bool? isOverLimit;
|
||||
final int? createdAt;
|
||||
final int? updatedAt;
|
||||
|
||||
factory BoardColumn.fromJson(Map<String, dynamic> json) {
|
||||
final cardsJson = json['cards'];
|
||||
return BoardColumn(
|
||||
id: json['id'] as String?,
|
||||
boardId: json['board_id'] as String?,
|
||||
name: json['name'] as String?,
|
||||
order: (json['order'] as num?)?.toInt(),
|
||||
color: json['color'] as String?,
|
||||
limit: (json['limit'] as num?)?.toInt(),
|
||||
cards:
|
||||
cardsJson is List
|
||||
? cardsJson
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(BoardCard.fromJson)
|
||||
.toList()
|
||||
: <BoardCard>[],
|
||||
cardCount: (json['card_count'] as num?)?.toInt(),
|
||||
isOverLimit: json['is_over_limit'] as bool?,
|
||||
createdAt: unixTimestampFromJson(json['created_at']),
|
||||
updatedAt: unixTimestampFromJson(json['updated_at']),
|
||||
);
|
||||
}
|
||||
|
||||
BoardColumn copyWith({List<BoardCard>? cards, int? cardCount}) {
|
||||
return BoardColumn(
|
||||
id: id,
|
||||
boardId: boardId,
|
||||
name: name,
|
||||
order: order,
|
||||
color: color,
|
||||
limit: limit,
|
||||
cards: cards ?? this.cards,
|
||||
cardCount: cardCount ?? this.cardCount,
|
||||
isOverLimit: isOverLimit,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BoardCard {
|
||||
BoardCard({
|
||||
required this.id,
|
||||
required this.columnId,
|
||||
required this.tenderId,
|
||||
required this.title,
|
||||
required this.order,
|
||||
required this.priority,
|
||||
required this.labels,
|
||||
required this.dueDate,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
final String? id;
|
||||
final String? columnId;
|
||||
final String? tenderId;
|
||||
final String? title;
|
||||
final int? order;
|
||||
final String? priority;
|
||||
final List<String> labels;
|
||||
final int? dueDate;
|
||||
final int? createdAt;
|
||||
final int? updatedAt;
|
||||
|
||||
factory BoardCard.fromJson(Map<String, dynamic> json) {
|
||||
final labelsJson = json['labels'];
|
||||
return BoardCard(
|
||||
id: json['id'] as String?,
|
||||
columnId: json['column_id'] as String?,
|
||||
tenderId: json['tender_id'] as String?,
|
||||
title: json['title'] as String?,
|
||||
order: (json['order'] as num?)?.toInt(),
|
||||
priority: json['priority'] as String?,
|
||||
labels:
|
||||
labelsJson is List
|
||||
? labelsJson.whereType<String>().toList()
|
||||
: <String>[],
|
||||
dueDate: unixTimestampFromJson(json['due_date']),
|
||||
createdAt: unixTimestampFromJson(json['created_at']),
|
||||
updatedAt: unixTimestampFromJson(json['updated_at']),
|
||||
);
|
||||
}
|
||||
|
||||
BoardCard copyWith({String? columnId, int? order}) {
|
||||
return BoardCard(
|
||||
id: id,
|
||||
columnId: columnId ?? this.columnId,
|
||||
tenderId: tenderId,
|
||||
title: title,
|
||||
order: order ?? this.order,
|
||||
priority: priority,
|
||||
labels: labels,
|
||||
dueDate: dueDate,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,596 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'board_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BoardResponse {
|
||||
|
||||
bool? get success; String? get message; List<BoardData>? get data; ErrorModel? get error;
|
||||
/// Create a copy of BoardResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$BoardResponseCopyWith<BoardResponse> get copyWith => _$BoardResponseCopyWithImpl<BoardResponse>(this as BoardResponse, _$identity);
|
||||
|
||||
/// Serializes this BoardResponse to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BoardResponse&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other.data, data)&&(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,success,message,const DeepCollectionEquality().hash(data),error);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BoardResponse(success: $success, message: $message, data: $data, error: $error)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $BoardResponseCopyWith<$Res> {
|
||||
factory $BoardResponseCopyWith(BoardResponse value, $Res Function(BoardResponse) _then) = _$BoardResponseCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool? success, String? message, List<BoardData>? data, ErrorModel? error
|
||||
});
|
||||
|
||||
|
||||
$ErrorModelCopyWith<$Res>? get error;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$BoardResponseCopyWithImpl<$Res>
|
||||
implements $BoardResponseCopyWith<$Res> {
|
||||
_$BoardResponseCopyWithImpl(this._self, this._then);
|
||||
|
||||
final BoardResponse _self;
|
||||
final $Res Function(BoardResponse) _then;
|
||||
|
||||
/// Create a copy of BoardResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? success = freezed,Object? message = freezed,Object? data = freezed,Object? error = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||
as List<BoardData>?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||
as ErrorModel?,
|
||||
));
|
||||
}
|
||||
/// Create a copy of BoardResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ErrorModelCopyWith<$Res>? get error {
|
||||
if (_self.error == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
|
||||
return _then(_self.copyWith(error: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BoardResponse].
|
||||
extension BoardResponsePatterns on BoardResponse {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _BoardResponse value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardResponse() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _BoardResponse value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardResponse():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _BoardResponse value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardResponse() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool? success, String? message, List<BoardData>? data, ErrorModel? error)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardResponse() when $default != null:
|
||||
return $default(_that.success,_that.message,_that.data,_that.error);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool? success, String? message, List<BoardData>? data, ErrorModel? error) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardResponse():
|
||||
return $default(_that.success,_that.message,_that.data,_that.error);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool? success, String? message, List<BoardData>? data, ErrorModel? error)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardResponse() when $default != null:
|
||||
return $default(_that.success,_that.message,_that.data,_that.error);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _BoardResponse implements BoardResponse {
|
||||
const _BoardResponse({required this.success, required this.message, required final List<BoardData>? data, required this.error}): _data = data;
|
||||
factory _BoardResponse.fromJson(Map<String, dynamic> json) => _$BoardResponseFromJson(json);
|
||||
|
||||
@override final bool? success;
|
||||
@override final String? message;
|
||||
final List<BoardData>? _data;
|
||||
@override List<BoardData>? get data {
|
||||
final value = _data;
|
||||
if (value == null) return null;
|
||||
if (_data is EqualUnmodifiableListView) return _data;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override final ErrorModel? error;
|
||||
|
||||
/// Create a copy of BoardResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$BoardResponseCopyWith<_BoardResponse> get copyWith => __$BoardResponseCopyWithImpl<_BoardResponse>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$BoardResponseToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BoardResponse&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other._data, _data)&&(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,success,message,const DeepCollectionEquality().hash(_data),error);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BoardResponse(success: $success, message: $message, data: $data, error: $error)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$BoardResponseCopyWith<$Res> implements $BoardResponseCopyWith<$Res> {
|
||||
factory _$BoardResponseCopyWith(_BoardResponse value, $Res Function(_BoardResponse) _then) = __$BoardResponseCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool? success, String? message, List<BoardData>? data, ErrorModel? error
|
||||
});
|
||||
|
||||
|
||||
@override $ErrorModelCopyWith<$Res>? get error;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$BoardResponseCopyWithImpl<$Res>
|
||||
implements _$BoardResponseCopyWith<$Res> {
|
||||
__$BoardResponseCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _BoardResponse _self;
|
||||
final $Res Function(_BoardResponse) _then;
|
||||
|
||||
/// Create a copy of BoardResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? success = freezed,Object? message = freezed,Object? data = freezed,Object? error = freezed,}) {
|
||||
return _then(_BoardResponse(
|
||||
success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,data: freezed == data ? _self._data : data // ignore: cast_nullable_to_non_nullable
|
||||
as List<BoardData>?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||
as ErrorModel?,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of BoardResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ErrorModelCopyWith<$Res>? get error {
|
||||
if (_self.error == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
|
||||
return _then(_self.copyWith(error: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BoardData {
|
||||
|
||||
String? get id; String? get description; DateTime? get deadline; String? get assignedTo; bool? get isReady; String? get status;
|
||||
/// Create a copy of BoardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$BoardDataCopyWith<BoardData> get copyWith => _$BoardDataCopyWithImpl<BoardData>(this as BoardData, _$identity);
|
||||
|
||||
/// Serializes this BoardData to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BoardData&&(identical(other.id, id) || other.id == id)&&(identical(other.description, description) || other.description == description)&&(identical(other.deadline, deadline) || other.deadline == deadline)&&(identical(other.assignedTo, assignedTo) || other.assignedTo == assignedTo)&&(identical(other.isReady, isReady) || other.isReady == isReady)&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,description,deadline,assignedTo,isReady,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BoardData(id: $id, description: $description, deadline: $deadline, assignedTo: $assignedTo, isReady: $isReady, status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $BoardDataCopyWith<$Res> {
|
||||
factory $BoardDataCopyWith(BoardData value, $Res Function(BoardData) _then) = _$BoardDataCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String? id, String? description, DateTime? deadline, String? assignedTo, bool? isReady, String? status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$BoardDataCopyWithImpl<$Res>
|
||||
implements $BoardDataCopyWith<$Res> {
|
||||
_$BoardDataCopyWithImpl(this._self, this._then);
|
||||
|
||||
final BoardData _self;
|
||||
final $Res Function(BoardData) _then;
|
||||
|
||||
/// Create a copy of BoardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? description = freezed,Object? deadline = freezed,Object? assignedTo = freezed,Object? isReady = freezed,Object? status = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deadline: freezed == deadline ? _self.deadline : deadline // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,assignedTo: freezed == assignedTo ? _self.assignedTo : assignedTo // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isReady: freezed == isReady ? _self.isReady : isReady // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BoardData].
|
||||
extension BoardDataPatterns on BoardData {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _BoardData value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardData() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _BoardData value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardData():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _BoardData value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardData() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? id, String? description, DateTime? deadline, String? assignedTo, bool? isReady, String? status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardData() when $default != null:
|
||||
return $default(_that.id,_that.description,_that.deadline,_that.assignedTo,_that.isReady,_that.status);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? id, String? description, DateTime? deadline, String? assignedTo, bool? isReady, String? status) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardData():
|
||||
return $default(_that.id,_that.description,_that.deadline,_that.assignedTo,_that.isReady,_that.status);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? id, String? description, DateTime? deadline, String? assignedTo, bool? isReady, String? status)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BoardData() when $default != null:
|
||||
return $default(_that.id,_that.description,_that.deadline,_that.assignedTo,_that.isReady,_that.status);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _BoardData implements BoardData {
|
||||
const _BoardData({required this.id, required this.description, required this.deadline, required this.assignedTo, required this.isReady, required this.status});
|
||||
factory _BoardData.fromJson(Map<String, dynamic> json) => _$BoardDataFromJson(json);
|
||||
|
||||
@override final String? id;
|
||||
@override final String? description;
|
||||
@override final DateTime? deadline;
|
||||
@override final String? assignedTo;
|
||||
@override final bool? isReady;
|
||||
@override final String? status;
|
||||
|
||||
/// Create a copy of BoardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$BoardDataCopyWith<_BoardData> get copyWith => __$BoardDataCopyWithImpl<_BoardData>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$BoardDataToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BoardData&&(identical(other.id, id) || other.id == id)&&(identical(other.description, description) || other.description == description)&&(identical(other.deadline, deadline) || other.deadline == deadline)&&(identical(other.assignedTo, assignedTo) || other.assignedTo == assignedTo)&&(identical(other.isReady, isReady) || other.isReady == isReady)&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,description,deadline,assignedTo,isReady,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BoardData(id: $id, description: $description, deadline: $deadline, assignedTo: $assignedTo, isReady: $isReady, status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$BoardDataCopyWith<$Res> implements $BoardDataCopyWith<$Res> {
|
||||
factory _$BoardDataCopyWith(_BoardData value, $Res Function(_BoardData) _then) = __$BoardDataCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String? id, String? description, DateTime? deadline, String? assignedTo, bool? isReady, String? status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$BoardDataCopyWithImpl<$Res>
|
||||
implements _$BoardDataCopyWith<$Res> {
|
||||
__$BoardDataCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _BoardData _self;
|
||||
final $Res Function(_BoardData) _then;
|
||||
|
||||
/// Create a copy of BoardData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? description = freezed,Object? deadline = freezed,Object? assignedTo = freezed,Object? isReady = freezed,Object? status = freezed,}) {
|
||||
return _then(_BoardData(
|
||||
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deadline: freezed == deadline ? _self.deadline : deadline // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,assignedTo: freezed == assignedTo ? _self.assignedTo : assignedTo // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isReady: freezed == isReady ? _self.isReady : isReady // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,51 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'board_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_BoardResponse _$BoardResponseFromJson(Map<String, dynamic> json) =>
|
||||
_BoardResponse(
|
||||
success: json['success'] as bool?,
|
||||
message: json['message'] as String?,
|
||||
data:
|
||||
(json['data'] as List<dynamic>?)
|
||||
?.map((e) => BoardData.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
error:
|
||||
json['error'] == null
|
||||
? null
|
||||
: ErrorModel.fromJson(json['error'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$BoardResponseToJson(_BoardResponse instance) =>
|
||||
<String, dynamic>{
|
||||
'success': instance.success,
|
||||
'message': instance.message,
|
||||
'data': instance.data,
|
||||
'error': instance.error,
|
||||
};
|
||||
|
||||
_BoardData _$BoardDataFromJson(Map<String, dynamic> json) => _BoardData(
|
||||
id: json['id'] as String?,
|
||||
description: json['description'] as String?,
|
||||
deadline:
|
||||
json['deadline'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deadline'] as String),
|
||||
assignedTo: json['assignedTo'] as String?,
|
||||
isReady: json['isReady'] as bool?,
|
||||
status: json['status'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$BoardDataToJson(_BoardData instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'description': instance.description,
|
||||
'deadline': instance.deadline?.toIso8601String(),
|
||||
'assignedTo': instance.assignedTo,
|
||||
'isReady': instance.isReady,
|
||||
'status': instance.status,
|
||||
};
|
||||
Reference in New Issue
Block a user