Skip to content

Commit

Permalink
chore(deps): upgrade logger to 2.0.1 (#18)
Browse files Browse the repository at this point in the history
BREAKING CHANGE

* upgrade logger to 2.0.1
* exchange pretty printer default values
* adjust unit tests for logger
* remove warnings

---------

Co-authored-by: Fernando Ferrara <[email protected]>
  • Loading branch information
sebastianbuechler and ferrarafer committed Apr 9, 2024
1 parent 7125a51 commit 49f638e
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 113 deletions.
9 changes: 4 additions & 5 deletions lib/src/generators/forms/field_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,20 @@ class TextFieldConfig extends FieldConfig {
final ExecutableElementData? validatorFunction;
final ExecutableElementData? customTextEditingController;
const TextFieldConfig({
required String name,
required super.name,
this.initialValue,
this.validatorFunction,
this.customTextEditingController,
}) : super(name: name);
});
}

class DateFieldConfig extends FieldConfig {
const DateFieldConfig({required String name}) : super(name: name);
const DateFieldConfig({required super.name});
}

class DropdownFieldConfig extends FieldConfig {
final List<DropdownFieldItem> items;
const DropdownFieldConfig({required String name, required this.items})
: super(name: name);
const DropdownFieldConfig({required super.name, required this.items});
}

class DropdownFieldItem {
Expand Down
20 changes: 7 additions & 13 deletions lib/src/generators/getit/dependency_config/factory_dependency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ import 'package:stacked_generator/src/generators/extensions/string_utils_extensi

class FactoryDependency extends DependencyConfig {
const FactoryDependency({
required String import,
required String className,
String? abstractedImport,
String? abstractedTypeClassName,
Set<String>? environments,
String? instanceName,
}) : super(
instanceName: instanceName,
import: import,
className: className,
abstractedImport: abstractedImport,
abstractedTypeClassName: abstractedTypeClassName,
environments: environments);
required super.import,
required super.className,
super.abstractedImport,
super.abstractedTypeClassName,
super.environments,
super.instanceName,
});

@override
String registerDependencies(String locatorName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@ class FactoryParamDependency extends DependencyConfig {
final Set<FactoryParameter>? params;

const FactoryParamDependency({
required String import,
required String className,
String? abstractedImport,
String? abstractedTypeClassName,
Set<String>? environments,
required super.import,
required super.className,
super.abstractedImport,
super.abstractedTypeClassName,
super.environments,
this.params,
String? instanceName,
}) : super(
instanceName: instanceName,
import: import,
className: className,
abstractedImport: abstractedImport,
abstractedTypeClassName: abstractedTypeClassName,
environments: environments);
super.instanceName,
});
Set<String> extraImports() {
if (params == null) return {};
return params!.map((e) => e.imports ?? {}).fold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@ import 'package:stacked_generator/src/generators/extensions/string_utils_extensi

class InitializableSingletonDependency extends DependencyConfig {
const InitializableSingletonDependency({
required String import,
required String className,
String? abstractedImport,
String? abstractedTypeClassName,
Set<String>? environments,
String? instanceName,
}) : super(
instanceName: instanceName,
import: import,
className: className,
abstractedImport: abstractedImport,
abstractedTypeClassName: abstractedTypeClassName,
environments: environments,
);
required super.import,
required super.className,
super.abstractedImport,
super.abstractedTypeClassName,
super.environments,
super.instanceName,
});

@override
String registerDependencies(String locatorName) {
Expand Down
20 changes: 7 additions & 13 deletions lib/src/generators/getit/dependency_config/lazy_singleton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ class LazySingletonDependency extends DependencyConfig {
final String? resolveFunction;

const LazySingletonDependency({
required String import,
required String className,
String? abstractedImport,
String? abstractedTypeClassName,
Set<String>? environments,
required super.import,
required super.className,
super.abstractedImport,
super.abstractedTypeClassName,
super.environments,
this.resolveFunction,
String? instanceName,
}) : super(
instanceName: instanceName,
import: import,
className: className,
abstractedImport: abstractedImport,
abstractedTypeClassName: abstractedTypeClassName,
environments: environments);
super.instanceName,
});

@override
String registerDependencies(String locatorName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ class PresolveSingletonDependency extends DependencyConfig {
final String? presolveFunction;

const PresolveSingletonDependency({
required String import,
required String className,
String? abstractedImport,
String? abstractedTypeClassName,
Set<String>? environments,
required super.import,
required super.className,
super.abstractedImport,
super.abstractedTypeClassName,
super.environments,
this.presolveFunction,
String? instanceName,
}) : super(
instanceName: instanceName,
import: import,
className: className,
abstractedImport: abstractedImport,
abstractedTypeClassName: abstractedTypeClassName,
environments: environments);
super.instanceName,
});

@override
String registerDependencies(String locatorName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ class SingletonDependency extends DependencyConfig {
final String? resolveFunction;

const SingletonDependency({
required String import,
required String className,
String? abstractedImport,
String? abstractedTypeClassName,
Set<String>? environments,
required super.import,
required super.className,
super.abstractedImport,
super.abstractedTypeClassName,
super.environments,
this.resolveFunction,
String? instanceName,
}) : super(
instanceName: instanceName,
import: import,
className: className,
abstractedImport: abstractedImport,
abstractedTypeClassName: abstractedTypeClassName,
environments: environments);
super.instanceName,
});

@override
String registerDependencies(String locatorName) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/generators/logging/logger_class_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class SimpleLogPrinter extends LogPrinter {
@override
List<String> log(LogEvent event) {
var color = PrettyPrinter.levelColors[event.level];
var emoji = PrettyPrinter.levelEmojis[event.level];
var color = PrettyPrinter.defaultLevelColors[event.level];
var emoji = PrettyPrinter.defaultLevelEmojis[event.level];
var methodName = _getMethodName();
var methodNameSection =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,11 @@ class FunctionParamConfig extends ParamConfig {
required super.isOptional,
required super.isNamed,
required super.element,
required bool isRequired,
required super.isRequired,
super.defaultValueCode,
}) : super(
isPathParam: false,
isQueryParam: false,
isRequired: isRequired,
isInheritedPathParam: false,
);

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
recase: ^4.0.0
source_gen: ^1.2.7
meta: ^1.10.0
logger: ^1.1.0
logger: ^2.0.1
stacked_shared: ^1.3.0
# Removing this will cause issues when publish the package
analyzer: ^6.3.0
Expand Down
2 changes: 0 additions & 2 deletions test/helpers/config_helper_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ void main() {
group('ConfigHelper -', () {
const String customConfigFilePath =
'/Users/filledstacks/Desktop/stacked.json';
const String xdgConfigFilePath =
'/Users/filledstacks/.config/stacked/stacked.json';

final StackedConfig customConfig = StackedConfig.fromJson({
"bottom_sheet_builder_file_path": "ui/setup/setup_bottom_sheet_ui.dart",
Expand Down
8 changes: 4 additions & 4 deletions test/helpers/test_constants/logger_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class SimpleLogPrinter extends LogPrinter {
@override
List<String> log(LogEvent event) {
var color = PrettyPrinter.levelColors[event.level];
var emoji = PrettyPrinter.levelEmojis[event.level];
var color = PrettyPrinter.defaultLevelColors[event.level];
var emoji = PrettyPrinter.defaultLevelEmojis[event.level];
var methodName = _getMethodName();
var methodNameSection =
Expand Down Expand Up @@ -192,8 +192,8 @@ class SimpleLogPrinter extends LogPrinter {
@override
List<String> log(LogEvent event) {
var color = PrettyPrinter.levelColors[event.level];
var emoji = PrettyPrinter.levelEmojis[event.level];
var color = PrettyPrinter.defaultLevelColors[event.level];
var emoji = PrettyPrinter.defaultLevelEmojis[event.level];
var methodName = _getMethodName();
var methodNameSection =
Expand Down
36 changes: 18 additions & 18 deletions test/logging/multi_output_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ void main() {
static bool destroyCalled = false;
@override
void init() {
Future<void> init() async {
initCalled = true;
super.init();
await super.init();
}
@override
void output(OutputEvent event) {
}
@override
void destroy() {
Future<void> destroy() async {
destroyCalled = true;
super.destroy();
await super.destroy();
}
}
Expand All @@ -48,19 +48,19 @@ void main() {
static bool destroyCalled = false;
@override
void init() {
Future<void> init() async {
initCalled = true;
super.init();
await super.init();
}
@override
void output(OutputEvent event) {
}
@override
void destroy() {
Future<void> destroy() async {
destroyCalled = true;
super.destroy();
await super.destroy();
}
}
Expand Down Expand Up @@ -103,19 +103,19 @@ void main() {
static bool destroyCalled = false;
@override
void init() {
Future<void> init() async {
initCalled = true;
super.init();
await super.init();
}
@override
void output(OutputEvent event) {
}
@override
void destroy() {
Future<void> destroy() async {
destroyCalled = true;
super.destroy();
await super.destroy();
}
}
Expand All @@ -124,27 +124,27 @@ void main() {
static bool destroyCalled = false;
@override
void init() {
Future<void> init() async {
initCalled = true;
super.init();
await super.init();
}
@override
void output(OutputEvent event) {
}
@override
void destroy() {
Future<void> destroy() async {
destroyCalled = true;
super.destroy();
await super.destroy();
}
}
$code
void main(_, SendPort port) {
Future<void> main(_, SendPort port) async {
final logger = getLogger('classname');
logger.close();
await logger.close();
port.send([One.initCalled, One.destroyCalled, Two.initCalled, Two.destroyCalled].join('-'));
}
''',
Expand Down

0 comments on commit 49f638e

Please sign in to comment.