better linting

This commit is contained in:
Mguy13 2023-01-01 13:04:22 +01:00
parent c7324a6b19
commit aa31a79d20
26 changed files with 163 additions and 131 deletions

View file

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
abstract class ConstColours {
/// Smoke Gray => a neutral grey with neutral warmth/cold
static const galleryBackgroundColour = Color.fromRGBO(127, 127, 125, 1.0);
static const galleryBackgroundColour = Color.fromRGBO(127, 127, 125, 1);
static const red = Colors.red;
static const white = Colors.white;

View file

@ -1,6 +1,7 @@
import 'package:dio/dio.dart';
extension ResponseExtensions on Response {
/// Extensions on [Dio]'s [Response].
extension ResponseExtensions<T> on Response<T> {
/// Shorthand for getting response's successful state.
bool get isSuccessful => (data as Map)['response'];
bool get isSuccessful => (data! as Map<String, dynamic>)['response'] as bool;
}

View file

@ -1,3 +1,4 @@
/// String extensions
extension StringExtensions on String {
/// Returns true if given word contains atleast all the characters in [targetChars], and `false` otherwise
///
@ -6,9 +7,9 @@ extension StringExtensions on String {
required String targetChars,
bool ignoreCase = true,
}) {
final Set<String> characterSet = ignoreCase
? Set.from(targetChars.toLowerCase().split(''))
: Set.from(targetChars.split(''));
final characterSet = ignoreCase
? Set<String>.from(targetChars.toLowerCase().split(''))
: Set<String>.from(targetChars.split(''));
for (final testChar in ignoreCase ? toLowerCase().split('') : split('')) {
characterSet.remove(testChar);
if (characterSet.isEmpty) return true;