exception_templates library

Provides generic exception and error templates.

Enables throwing specific errors/exceptions without having to declare new classes.

Classes

ErrorType
Base class for creating new error types.
ExceptionType
Base class for creating new exception types.
InvalidIdentifier
ErrorType indicating that an invalid Dart identifier was detected. [...]

Constants

BLUE → const String
Ansi color modifier.
'\u001B[34m'
CYAN → const String
Ansi color modifier.
'\u001B[36m'
GREEN → const String
Ansi color modifier.
'\u001B[32m'
RED → const String
Ansi color modifier.
'\u001B[31m'
RESET → const String
Ansi color modifier: Reset to default.
'\u001B[0m'
YELLOW → const String
Ansi color modifier.
'\u001B[33m'

Properties

dartKeywords UnmodifiableListView<String>
Returns a list of Dart keywords.
final

Functions

classNameToLibraryName(String className) String
Converts a capital camel case Dart class name to a lower case underscore separated Dart library name.
isValidIdentifier(String input) bool
Returns true if input is valid Dart variable identifier.
toColorString({Object message, Object expectedState, Object invalidState, ColorOutput colorOutput, Type errorType}) String
Transforms error/exception messages to an output string.
validateIdentifier(String input) → void
Throws GeneratorError is input is not a valid Dart identifier.

Enums

ColorOutput

Exceptions / Errors

ErrorOf<T>
Parameterized error template. [...]
ErrorOfType<T extends ErrorType>
Parameterized error template. [...]
ExceptionOf<T>
Parameterized exception class. The type argument hints at where the exception occured.
ExceptionOfType<T extends ExceptionType>
Parameterized exception template. The generic type T indicates what type of error occured. Usage: [...]