mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
Refactor apidash_core
This commit is contained in:
@ -11,3 +11,4 @@ export 'package:collection/collection.dart';
|
|||||||
export 'package:freezed_annotation/freezed_annotation.dart';
|
export 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
export 'package:http/http.dart';
|
export 'package:http/http.dart';
|
||||||
export 'package:http_parser/http_parser.dart';
|
export 'package:http_parser/http_parser.dart';
|
||||||
|
export 'package:seed/seed.dart';
|
||||||
|
@ -2,8 +2,6 @@ import 'dart:convert';
|
|||||||
|
|
||||||
enum HTTPVerb { get, head, post, put, patch, delete }
|
enum HTTPVerb { get, head, post, put, patch, delete }
|
||||||
|
|
||||||
enum FormDataType { text, file }
|
|
||||||
|
|
||||||
enum SupportedUriSchemes { https, http }
|
enum SupportedUriSchemes { https, http }
|
||||||
|
|
||||||
final kSupportedUriSchemes =
|
final kSupportedUriSchemes =
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
import '../consts.dart';
|
|
||||||
|
|
||||||
part 'form_data_model.freezed.dart';
|
|
||||||
part 'form_data_model.g.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class FormDataModel with _$FormDataModel {
|
|
||||||
const factory FormDataModel({
|
|
||||||
required String name,
|
|
||||||
required String value,
|
|
||||||
required FormDataType type,
|
|
||||||
}) = _FormDataModel;
|
|
||||||
|
|
||||||
factory FormDataModel.fromJson(Map<String, Object?> json) =>
|
|
||||||
_$FormDataModelFromJson(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
const kFormDataEmptyModel = FormDataModel(
|
|
||||||
name: "",
|
|
||||||
value: "",
|
|
||||||
type: FormDataType.text,
|
|
||||||
);
|
|
@ -1,187 +0,0 @@
|
|||||||
// coverage:ignore-file
|
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
// 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 'form_data_model.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// FreezedGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
T _$identity<T>(T value) => value;
|
|
||||||
|
|
||||||
final _privateConstructorUsedError = UnsupportedError(
|
|
||||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
|
||||||
|
|
||||||
FormDataModel _$FormDataModelFromJson(Map<String, dynamic> json) {
|
|
||||||
return _FormDataModel.fromJson(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$FormDataModel {
|
|
||||||
String get name => throw _privateConstructorUsedError;
|
|
||||||
String get value => throw _privateConstructorUsedError;
|
|
||||||
FormDataType get type => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
$FormDataModelCopyWith<FormDataModel> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $FormDataModelCopyWith<$Res> {
|
|
||||||
factory $FormDataModelCopyWith(
|
|
||||||
FormDataModel value, $Res Function(FormDataModel) then) =
|
|
||||||
_$FormDataModelCopyWithImpl<$Res, FormDataModel>;
|
|
||||||
@useResult
|
|
||||||
$Res call({String name, String value, FormDataType type});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$FormDataModelCopyWithImpl<$Res, $Val extends FormDataModel>
|
|
||||||
implements $FormDataModelCopyWith<$Res> {
|
|
||||||
_$FormDataModelCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? name = null,
|
|
||||||
Object? value = null,
|
|
||||||
Object? type = null,
|
|
||||||
}) {
|
|
||||||
return _then(_value.copyWith(
|
|
||||||
name: null == name
|
|
||||||
? _value.name
|
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
value: null == value
|
|
||||||
? _value.value
|
|
||||||
: value // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
type: null == type
|
|
||||||
? _value.type
|
|
||||||
: type // ignore: cast_nullable_to_non_nullable
|
|
||||||
as FormDataType,
|
|
||||||
) as $Val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$FormDataModelImplCopyWith<$Res>
|
|
||||||
implements $FormDataModelCopyWith<$Res> {
|
|
||||||
factory _$$FormDataModelImplCopyWith(
|
|
||||||
_$FormDataModelImpl value, $Res Function(_$FormDataModelImpl) then) =
|
|
||||||
__$$FormDataModelImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({String name, String value, FormDataType type});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$FormDataModelImplCopyWithImpl<$Res>
|
|
||||||
extends _$FormDataModelCopyWithImpl<$Res, _$FormDataModelImpl>
|
|
||||||
implements _$$FormDataModelImplCopyWith<$Res> {
|
|
||||||
__$$FormDataModelImplCopyWithImpl(
|
|
||||||
_$FormDataModelImpl _value, $Res Function(_$FormDataModelImpl) _then)
|
|
||||||
: super(_value, _then);
|
|
||||||
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? name = null,
|
|
||||||
Object? value = null,
|
|
||||||
Object? type = null,
|
|
||||||
}) {
|
|
||||||
return _then(_$FormDataModelImpl(
|
|
||||||
name: null == name
|
|
||||||
? _value.name
|
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
value: null == value
|
|
||||||
? _value.value
|
|
||||||
: value // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
type: null == type
|
|
||||||
? _value.type
|
|
||||||
: type // ignore: cast_nullable_to_non_nullable
|
|
||||||
as FormDataType,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
@JsonSerializable()
|
|
||||||
class _$FormDataModelImpl implements _FormDataModel {
|
|
||||||
const _$FormDataModelImpl(
|
|
||||||
{required this.name, required this.value, required this.type});
|
|
||||||
|
|
||||||
factory _$FormDataModelImpl.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$$FormDataModelImplFromJson(json);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String name;
|
|
||||||
@override
|
|
||||||
final String value;
|
|
||||||
@override
|
|
||||||
final FormDataType type;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'FormDataModel(name: $name, value: $value, type: $type)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$FormDataModelImpl &&
|
|
||||||
(identical(other.name, name) || other.name == name) &&
|
|
||||||
(identical(other.value, value) || other.value == value) &&
|
|
||||||
(identical(other.type, type) || other.type == type));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType, name, value, type);
|
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$FormDataModelImplCopyWith<_$FormDataModelImpl> get copyWith =>
|
|
||||||
__$$FormDataModelImplCopyWithImpl<_$FormDataModelImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return _$$FormDataModelImplToJson(
|
|
||||||
this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _FormDataModel implements FormDataModel {
|
|
||||||
const factory _FormDataModel(
|
|
||||||
{required final String name,
|
|
||||||
required final String value,
|
|
||||||
required final FormDataType type}) = _$FormDataModelImpl;
|
|
||||||
|
|
||||||
factory _FormDataModel.fromJson(Map<String, dynamic> json) =
|
|
||||||
_$FormDataModelImpl.fromJson;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get name;
|
|
||||||
@override
|
|
||||||
String get value;
|
|
||||||
@override
|
|
||||||
FormDataType get type;
|
|
||||||
@override
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
_$$FormDataModelImplCopyWith<_$FormDataModelImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'form_data_model.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
_$FormDataModelImpl _$$FormDataModelImplFromJson(Map<String, dynamic> json) =>
|
|
||||||
_$FormDataModelImpl(
|
|
||||||
name: json['name'] as String,
|
|
||||||
value: json['value'] as String,
|
|
||||||
type: $enumDecode(_$FormDataTypeEnumMap, json['type']),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$FormDataModelImplToJson(_$FormDataModelImpl instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'name': instance.name,
|
|
||||||
'value': instance.value,
|
|
||||||
'type': _$FormDataTypeEnumMap[instance.type]!,
|
|
||||||
};
|
|
||||||
|
|
||||||
const _$FormDataTypeEnumMap = {
|
|
||||||
FormDataType.text: 'text',
|
|
||||||
FormDataType.file: 'file',
|
|
||||||
};
|
|
@ -1,10 +1,10 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:seed/seed.dart';
|
||||||
import '../utils/utils.dart'
|
import '../utils/utils.dart'
|
||||||
show rowsToFormDataMapList, rowsToMap, getEnabledRows;
|
show rowsToFormDataMapList, rowsToMap, getEnabledRows;
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
import 'models.dart';
|
|
||||||
|
|
||||||
part 'http_request_model.freezed.dart';
|
part 'http_request_model.freezed.dart';
|
||||||
|
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
export 'form_data_model.dart';
|
|
||||||
export 'http_request_model.dart';
|
export 'http_request_model.dart';
|
||||||
export 'http_response_model.dart';
|
export 'http_response_model.dart';
|
||||||
export 'name_value_model.dart';
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
|
|
||||||
part 'name_value_model.freezed.dart';
|
|
||||||
|
|
||||||
part 'name_value_model.g.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
class NameValueModel with _$NameValueModel {
|
|
||||||
const factory NameValueModel({
|
|
||||||
required String name,
|
|
||||||
required dynamic value,
|
|
||||||
}) = _NameValueModel;
|
|
||||||
|
|
||||||
factory NameValueModel.fromJson(Map<String, Object?> json) =>
|
|
||||||
_$NameValueModelFromJson(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
const kNameValueEmptyModel = NameValueModel(name: "", value: "");
|
|
@ -1,182 +0,0 @@
|
|||||||
// coverage:ignore-file
|
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
// 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 'name_value_model.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// FreezedGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
T _$identity<T>(T value) => value;
|
|
||||||
|
|
||||||
final _privateConstructorUsedError = UnsupportedError(
|
|
||||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
|
||||||
|
|
||||||
NameValueModel _$NameValueModelFromJson(Map<String, dynamic> json) {
|
|
||||||
return _NameValueModel.fromJson(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$NameValueModel {
|
|
||||||
String get name => throw _privateConstructorUsedError;
|
|
||||||
dynamic get value => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
$NameValueModelCopyWith<NameValueModel> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class $NameValueModelCopyWith<$Res> {
|
|
||||||
factory $NameValueModelCopyWith(
|
|
||||||
NameValueModel value, $Res Function(NameValueModel) then) =
|
|
||||||
_$NameValueModelCopyWithImpl<$Res, NameValueModel>;
|
|
||||||
@useResult
|
|
||||||
$Res call({String name, dynamic value});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$NameValueModelCopyWithImpl<$Res, $Val extends NameValueModel>
|
|
||||||
implements $NameValueModelCopyWith<$Res> {
|
|
||||||
_$NameValueModelCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Val _value;
|
|
||||||
// ignore: unused_field
|
|
||||||
final $Res Function($Val) _then;
|
|
||||||
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? name = null,
|
|
||||||
Object? value = freezed,
|
|
||||||
}) {
|
|
||||||
return _then(_value.copyWith(
|
|
||||||
name: null == name
|
|
||||||
? _value.name
|
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
value: freezed == value
|
|
||||||
? _value.value
|
|
||||||
: value // ignore: cast_nullable_to_non_nullable
|
|
||||||
as dynamic,
|
|
||||||
) as $Val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract class _$$NameValueModelImplCopyWith<$Res>
|
|
||||||
implements $NameValueModelCopyWith<$Res> {
|
|
||||||
factory _$$NameValueModelImplCopyWith(_$NameValueModelImpl value,
|
|
||||||
$Res Function(_$NameValueModelImpl) then) =
|
|
||||||
__$$NameValueModelImplCopyWithImpl<$Res>;
|
|
||||||
@override
|
|
||||||
@useResult
|
|
||||||
$Res call({String name, dynamic value});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class __$$NameValueModelImplCopyWithImpl<$Res>
|
|
||||||
extends _$NameValueModelCopyWithImpl<$Res, _$NameValueModelImpl>
|
|
||||||
implements _$$NameValueModelImplCopyWith<$Res> {
|
|
||||||
__$$NameValueModelImplCopyWithImpl(
|
|
||||||
_$NameValueModelImpl _value, $Res Function(_$NameValueModelImpl) _then)
|
|
||||||
: super(_value, _then);
|
|
||||||
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
@override
|
|
||||||
$Res call({
|
|
||||||
Object? name = null,
|
|
||||||
Object? value = freezed,
|
|
||||||
}) {
|
|
||||||
return _then(_$NameValueModelImpl(
|
|
||||||
name: null == name
|
|
||||||
? _value.name
|
|
||||||
: name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
|
||||||
value: freezed == value
|
|
||||||
? _value.value
|
|
||||||
: value // ignore: cast_nullable_to_non_nullable
|
|
||||||
as dynamic,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
@JsonSerializable()
|
|
||||||
class _$NameValueModelImpl
|
|
||||||
with DiagnosticableTreeMixin
|
|
||||||
implements _NameValueModel {
|
|
||||||
const _$NameValueModelImpl({required this.name, required this.value});
|
|
||||||
|
|
||||||
factory _$NameValueModelImpl.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$$NameValueModelImplFromJson(json);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String name;
|
|
||||||
@override
|
|
||||||
final dynamic value;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
|
||||||
return 'NameValueModel(name: $name, value: $value)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
|
||||||
super.debugFillProperties(properties);
|
|
||||||
properties
|
|
||||||
..add(DiagnosticsProperty('type', 'NameValueModel'))
|
|
||||||
..add(DiagnosticsProperty('name', name))
|
|
||||||
..add(DiagnosticsProperty('value', value));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) ||
|
|
||||||
(other.runtimeType == runtimeType &&
|
|
||||||
other is _$NameValueModelImpl &&
|
|
||||||
(identical(other.name, name) || other.name == name) &&
|
|
||||||
const DeepCollectionEquality().equals(other.value, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
runtimeType, name, const DeepCollectionEquality().hash(value));
|
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$NameValueModelImplCopyWith<_$NameValueModelImpl> get copyWith =>
|
|
||||||
__$$NameValueModelImplCopyWithImpl<_$NameValueModelImpl>(
|
|
||||||
this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return _$$NameValueModelImplToJson(
|
|
||||||
this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _NameValueModel implements NameValueModel {
|
|
||||||
const factory _NameValueModel(
|
|
||||||
{required final String name,
|
|
||||||
required final dynamic value}) = _$NameValueModelImpl;
|
|
||||||
|
|
||||||
factory _NameValueModel.fromJson(Map<String, dynamic> json) =
|
|
||||||
_$NameValueModelImpl.fromJson;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get name;
|
|
||||||
@override
|
|
||||||
dynamic get value;
|
|
||||||
@override
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
_$$NameValueModelImplCopyWith<_$NameValueModelImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'name_value_model.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
_$NameValueModelImpl _$$NameValueModelImplFromJson(Map<String, dynamic> json) =>
|
|
||||||
_$NameValueModelImpl(
|
|
||||||
name: json['name'] as String,
|
|
||||||
value: json['value'],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$NameValueModelImplToJson(
|
|
||||||
_$NameValueModelImpl instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'name': instance.name,
|
|
||||||
'value': instance.value,
|
|
||||||
};
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:seed/seed.dart';
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
import '../models/models.dart';
|
import '../models/models.dart';
|
||||||
import '../utils/utils.dart';
|
import '../utils/utils.dart';
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import '../consts.dart';
|
import 'package:seed/seed.dart';
|
||||||
import '../models/models.dart';
|
|
||||||
|
|
||||||
Map<String, String>? rowsToMap(List<NameValueModel>? kvRows,
|
Map<String, String>? rowsToMap(List<NameValueModel>? kvRows,
|
||||||
{bool isHeader = false}) {
|
{bool isHeader = false}) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:collection/collection.dart' show mergeMaps;
|
import 'package:collection/collection.dart' show mergeMaps;
|
||||||
|
import 'package:seed/seed.dart';
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
import '../models/name_value_model.dart';
|
|
||||||
import 'http_request_utils.dart';
|
import 'http_request_utils.dart';
|
||||||
|
|
||||||
(String?, bool) getUriScheme(Uri uri) {
|
(String?, bool) getUriScheme(Uri uri) {
|
||||||
|
@ -15,6 +15,7 @@ dependencies:
|
|||||||
freezed_annotation: ^2.4.1
|
freezed_annotation: ^2.4.1
|
||||||
http: ^1.2.1
|
http: ^1.2.1
|
||||||
http_parser: ^4.0.2
|
http_parser: ^4.0.2
|
||||||
|
seed: ^0.0.2
|
||||||
xml: ^6.3.0
|
xml: ^6.3.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
import 'package:apidash_core/apidash_core.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
const fdmRow1 = FormDataModel(
|
|
||||||
name: "harry",
|
|
||||||
value: "23",
|
|
||||||
type: FormDataType.text,
|
|
||||||
);
|
|
||||||
|
|
||||||
test('Testing toString()', () {
|
|
||||||
const resultExpected =
|
|
||||||
'FormDataModel(name: harry, value: 23, type: FormDataType.text)';
|
|
||||||
expect(fdmRow1.toString(), resultExpected);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Testing toJson()', () {
|
|
||||||
const resultExpected = {"name": "harry", "value": "23", "type": "text"};
|
|
||||||
expect(fdmRow1.toJson(), resultExpected);
|
|
||||||
});
|
|
||||||
test('Testing fromJson()', () {
|
|
||||||
const resultExpected = fdmRow1;
|
|
||||||
expect(
|
|
||||||
FormDataModel.fromJson(
|
|
||||||
{"name": "harry", "value": "23", "type": "text"}),
|
|
||||||
resultExpected);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Testing copyWith()', () {
|
|
||||||
const resultExpected = FormDataModel(
|
|
||||||
name: "winter",
|
|
||||||
value: "26",
|
|
||||||
type: FormDataType.file,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
fdmRow1.copyWith(name: "winter", value: "26", type: FormDataType.file),
|
|
||||||
resultExpected);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Testing hashcode', () {
|
|
||||||
expect(fdmRow1.hashCode, greaterThan(0));
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
import 'package:apidash_core/apidash_core.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
const nmRow1 = NameValueModel(name: "harry", value: 23);
|
|
||||||
|
|
||||||
test('Testing toString()', () {
|
|
||||||
const resultExpected = 'NameValueModel(name: harry, value: 23)';
|
|
||||||
expect(nmRow1.toString(), resultExpected);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Testing toJson()', () {
|
|
||||||
const resultExpected = {"name": "harry", "value": 23};
|
|
||||||
expect(nmRow1.toJson(), resultExpected);
|
|
||||||
});
|
|
||||||
test('Testing fromJson()', () {
|
|
||||||
const resultExpected = nmRow1;
|
|
||||||
expect(NameValueModel.fromJson({"name": "harry", "value": 23}),
|
|
||||||
resultExpected);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Testing copyWith()', () {
|
|
||||||
const resultExpected = NameValueModel(name: "winter", value: "26");
|
|
||||||
expect(nmRow1.copyWith(name: "winter", value: "26"), resultExpected);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Testing hashcode', () {
|
|
||||||
expect(nmRow1.hashCode, greaterThan(0));
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:apidash_core/models/models.dart';
|
|
||||||
import 'package:apidash_core/utils/uri_utils.dart';
|
import 'package:apidash_core/utils/uri_utils.dart';
|
||||||
|
import 'package:seed/seed.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -1321,6 +1321,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.8"
|
version: "0.3.8"
|
||||||
|
seed:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: seed
|
||||||
|
sha256: "5c5ac5d73bf94e4b207d8c283903fc2b62ca8015e519b99949a8389605ee0eef"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.2"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
Reference in New Issue
Block a user