TF-528 Apply linter for some widget
This commit is contained in:
@@ -2,31 +2,31 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class VerifyNameException extends Equatable implements Exception {
|
||||
static const EmptyName = 'The name cannot be empty!';
|
||||
static const DuplicatedName = 'The name already exists!';
|
||||
static const NameContainSpecialCharacter = 'The name cannot contain special characters';
|
||||
static const emptyName = 'The name cannot be empty!';
|
||||
static const duplicatedName = 'The name already exists!';
|
||||
static const nameContainSpecialCharacter = 'The name cannot contain special characters';
|
||||
|
||||
final String? message;
|
||||
|
||||
VerifyNameException(this.message);
|
||||
const VerifyNameException(this.message);
|
||||
}
|
||||
|
||||
class EmptyNameException extends VerifyNameException {
|
||||
EmptyNameException() : super(VerifyNameException.EmptyName);
|
||||
const EmptyNameException() : super(VerifyNameException.emptyName);
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class DuplicatedNameException extends VerifyNameException {
|
||||
DuplicatedNameException() : super(VerifyNameException.DuplicatedName);
|
||||
const DuplicatedNameException() : super(VerifyNameException.duplicatedName);
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class SpecialCharacterException extends VerifyNameException {
|
||||
SpecialCharacterException() : super(VerifyNameException.NameContainSpecialCharacter);
|
||||
const SpecialCharacterException() : super(VerifyNameException.nameContainSpecialCharacter);
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ class DuplicateNameValidator extends Validator<NewNameRequest> {
|
||||
.map((nameItem) => nameItem.toLowerCase())
|
||||
.contains(newNameRequest.value!.toLowerCase());
|
||||
if (nameExist) {
|
||||
return Left<Failure, Success>(VerifyNameFailure(DuplicatedNameException()));
|
||||
return Left<Failure, Success>(VerifyNameFailure(const DuplicatedNameException()));
|
||||
} else {
|
||||
return Right<Failure, Success>(VerifyNameViewState());
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class EmptyNameValidator extends Validator<NewNameRequest> {
|
||||
@override
|
||||
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
|
||||
if (newNameRequest.value == null || newNameRequest.value!.isEmpty) {
|
||||
return Left<Failure, Success>(VerifyNameFailure(EmptyNameException()));
|
||||
return Left<Failure, Success>(VerifyNameFailure(const EmptyNameException()));
|
||||
} else {
|
||||
return Right<Failure, Success>(VerifyNameViewState());
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class SpecialCharacterValidator extends Validator<NewNameRequest> {
|
||||
@override
|
||||
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
|
||||
if (newNameRequest.value != null && newNameRequest.value!.hasSpecialCharactersInName()) {
|
||||
return Left<Failure, Success>(VerifyNameFailure(SpecialCharacterException()));
|
||||
return Left<Failure, Success>(VerifyNameFailure(const SpecialCharacterException()));
|
||||
} else {
|
||||
return Right<Failure, Success>(VerifyNameViewState());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user