parent
bd338c00c2
commit
8e0441e224
45 changed files with 538 additions and 256 deletions
@ -1,28 +1,37 @@ |
|||||||
# This file configures the analyzer, which statically analyzes Dart code to |
|
||||||
# check for errors, warnings, and lints. |
|
||||||
# |
|
||||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled |
|
||||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be |
|
||||||
# invoked from the command line by running `flutter analyze`. |
|
||||||
|
|
||||||
# The following line activates a set of recommended lints for Flutter apps, |
|
||||||
# packages, and plugins designed to encourage good coding practices. |
|
||||||
include: package:flutter_lints/flutter.yaml |
include: package:flutter_lints/flutter.yaml |
||||||
|
|
||||||
|
analyzer: |
||||||
|
errors: |
||||||
|
undefined_prefixed_name: ignore |
||||||
|
unsafe_html: ignore |
||||||
linter: |
linter: |
||||||
# The lint rules applied to this project can be customized in the |
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` |
|
||||||
# included above or to enable additional rules. A list of all available lints |
|
||||||
# and their documentation is published at https://dart.dev/lints. |
|
||||||
# |
|
||||||
# Instead of disabling a lint rule for the entire project in the |
|
||||||
# section below, it can also be suppressed for a single line of code |
|
||||||
# or a specific dart file by using the `// ignore: name_of_lint` and |
|
||||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file |
|
||||||
# producing the lint. |
|
||||||
rules: |
rules: |
||||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule |
always_declare_return_types: true |
||||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule |
always_put_required_named_parameters_first: true |
||||||
|
annotate_overrides: true |
||||||
# Additional information about this file can be found at |
avoid_empty_else: true |
||||||
# https://dart.dev/guides/language/analysis-options |
avoid_escaping_inner_quotes: true |
||||||
|
avoid_print: true |
||||||
|
avoid_redundant_argument_values: true |
||||||
|
avoid_types_on_closure_parameters: true |
||||||
|
avoid_void_async: true |
||||||
|
cascade_invocations: true |
||||||
|
directives_ordering: true |
||||||
|
omit_local_variable_types: true |
||||||
|
prefer_const_constructors: true |
||||||
|
prefer_const_constructors_in_immutables: true |
||||||
|
prefer_const_declarations: true |
||||||
|
prefer_final_fields: true |
||||||
|
prefer_final_in_for_each: true |
||||||
|
prefer_final_locals: true |
||||||
|
prefer_initializing_formals: true |
||||||
|
prefer_int_literals: true |
||||||
|
prefer_interpolation_to_compose_strings: true |
||||||
|
prefer_relative_imports: true |
||||||
|
prefer_single_quotes: true |
||||||
|
sort_constructors_first: true |
||||||
|
sort_unnamed_constructors_first: true |
||||||
|
unnecessary_lambdas: true |
||||||
|
unnecessary_parenthesis: true |
||||||
|
unnecessary_string_interpolations: true |
||||||
|
library_private_types_in_public_api: false |
||||||
|
@ -1,12 +0,0 @@ |
|||||||
// import 'package:meta/meta.dart'; |
|
||||||
|
|
||||||
// @immutable |
|
||||||
// class NetworkException implements Exception { |
|
||||||
// const NetworkException({required this.message}); |
|
||||||
|
|
||||||
// final String message; |
|
||||||
|
|
||||||
// @override |
|
||||||
// String toString() => |
|
||||||
// 'Error while loading something from the network: $message'; |
|
||||||
// } |
|
@ -1 +1,2 @@ |
|||||||
|
/// This will be empty for now |
||||||
void main() {} |
void main() {} |
||||||
|
@ -0,0 +1,68 @@ |
|||||||
|
import 'dart:async' show Zone; |
||||||
|
import 'dart:developer' as dev show log; |
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart' show kDebugMode; |
||||||
|
import 'package:meta/meta.dart' show immutable; |
||||||
|
|
||||||
|
/// Simple logger for the quill libraries |
||||||
|
/// |
||||||
|
/// it log only if [kDebugMode] is true |
||||||
|
/// so only for development mode and not in production |
||||||
|
/// |
||||||
|
@immutable |
||||||
|
class QuillLogger { |
||||||
|
const QuillLogger._(); |
||||||
|
|
||||||
|
static bool shouldLog() { |
||||||
|
return kDebugMode; |
||||||
|
} |
||||||
|
|
||||||
|
static void log<T>( |
||||||
|
T message, { |
||||||
|
DateTime? time, |
||||||
|
int? sequenceNumber, |
||||||
|
int level = 0, |
||||||
|
String name = '', |
||||||
|
Zone? zone, |
||||||
|
StackTrace? stackTrace, |
||||||
|
}) { |
||||||
|
if (!shouldLog()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
dev.log( |
||||||
|
message.toString(), |
||||||
|
time: time, |
||||||
|
sequenceNumber: sequenceNumber, |
||||||
|
level: level, |
||||||
|
name: name, |
||||||
|
zone: zone, |
||||||
|
stackTrace: stackTrace, |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
static void error<T>( |
||||||
|
T message, { |
||||||
|
DateTime? time, |
||||||
|
int? sequenceNumber, |
||||||
|
int level = 0, |
||||||
|
String name = '', |
||||||
|
Zone? zone, |
||||||
|
Object? error, |
||||||
|
StackTrace? stackTrace, |
||||||
|
}) { |
||||||
|
if (!shouldLog()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
dev.log( |
||||||
|
message.toString(), |
||||||
|
time: time, |
||||||
|
sequenceNumber: sequenceNumber, |
||||||
|
level: level, |
||||||
|
name: name, |
||||||
|
zone: zone, |
||||||
|
error: error, |
||||||
|
stackTrace: stackTrace, |
||||||
|
); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue