-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add freezed support to feature_brick
- Loading branch information
Adam Buchweitz
committed
Jul 11, 2022
1 parent
6aae6ad
commit 9b0d006
Showing
8 changed files
with
448 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...feature_brick/__brick__/{{feature_name.snakeCase()}}/{{#isBloc}}bloc{{/isBloc}}/bloc.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export 'package:flutter_bloc/flutter_bloc.dart'; | ||
export '{{feature_name.snakeCase()}}_bloc.dart'; | ||
export '{{feature_name.snakeCase()}}_bloc.dart';{{#use_freezed}} | ||
export '{{feature_name.snakeCase()}}_event.dart'; | ||
export '{{feature_name.snakeCase()}}_state.dart';{{/use_freezed}} |
166 changes: 166 additions & 0 deletions
166
.../isBloc}}/{{#use_freezed}}{{feature_name.snakeCase()}}_event.freezed.dart{{/use_freezed}}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target | ||
|
||
part of '{{feature_name.snakeCase()}}_event.dart'; | ||
|
||
// ************************************************************************** | ||
// FreezedGenerator | ||
// ************************************************************************** | ||
|
||
T _$identity<T>(T value) => value; | ||
|
||
final _privateConstructorUsedError = UnsupportedError( | ||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); | ||
|
||
/// @nodoc | ||
mixin _${{feature_name.pascalCase()}}Event { | ||
@optionalTypeArgs | ||
TResult when<TResult extends Object?>({ | ||
required TResult Function() event, | ||
}) => | ||
throw _privateConstructorUsedError; | ||
@optionalTypeArgs | ||
TResult? whenOrNull<TResult extends Object?>({ | ||
TResult Function()? event, | ||
}) => | ||
throw _privateConstructorUsedError; | ||
@optionalTypeArgs | ||
TResult maybeWhen<TResult extends Object?>({ | ||
TResult Function()? event, | ||
required TResult orElse(), | ||
}) => | ||
throw _privateConstructorUsedError; | ||
@optionalTypeArgs | ||
TResult map<TResult extends Object?>({ | ||
required TResult Function(Custom{{feature_name.pascalCase()}}Event value) event, | ||
}) => | ||
throw _privateConstructorUsedError; | ||
@optionalTypeArgs | ||
TResult? mapOrNull<TResult extends Object?>({ | ||
TResult Function(Custom{{feature_name.pascalCase()}}Event value)? event, | ||
}) => | ||
throw _privateConstructorUsedError; | ||
@optionalTypeArgs | ||
TResult maybeMap<TResult extends Object?>({ | ||
TResult Function(Custom{{feature_name.pascalCase()}}Event value)? event, | ||
required TResult orElse(), | ||
}) => | ||
throw _privateConstructorUsedError; | ||
} | ||
|
||
/// @nodoc | ||
abstract class ${{feature_name.pascalCase()}}EventCopyWith<$Res> { | ||
factory ${{feature_name.pascalCase()}}EventCopyWith( | ||
{{feature_name.pascalCase()}}Event value, $Res Function({{feature_name.pascalCase()}}Event) then) = | ||
_${{feature_name.pascalCase()}}EventCopyWithImpl<$Res>; | ||
} | ||
|
||
/// @nodoc | ||
class _${{feature_name.pascalCase()}}EventCopyWithImpl<$Res> implements ${{feature_name.pascalCase()}}EventCopyWith<$Res> { | ||
_${{feature_name.pascalCase()}}EventCopyWithImpl(this._value, this._then); | ||
|
||
final {{feature_name.pascalCase()}}Event _value; | ||
// ignore: unused_field | ||
final $Res Function({{feature_name.pascalCase()}}Event) _then; | ||
} | ||
|
||
/// @nodoc | ||
abstract class _$$Custom{{feature_name.pascalCase()}}EventCopyWith<$Res> { | ||
factory _$$Custom{{feature_name.pascalCase()}}EventCopyWith(_$Custom{{feature_name.pascalCase()}}Event value, | ||
$Res Function(_$Custom{{feature_name.pascalCase()}}Event) then) = | ||
__$$Custom{{feature_name.pascalCase()}}EventCopyWithImpl<$Res>; | ||
} | ||
|
||
/// @nodoc | ||
class __$$Custom{{feature_name.pascalCase()}}EventCopyWithImpl<$Res> | ||
extends _${{feature_name.pascalCase()}}EventCopyWithImpl<$Res> | ||
implements _$$Custom{{feature_name.pascalCase()}}EventCopyWith<$Res> { | ||
__$$Custom{{feature_name.pascalCase()}}EventCopyWithImpl( | ||
_$Custom{{feature_name.pascalCase()}}Event _value, $Res Function(_$Custom{{feature_name.pascalCase()}}Event) _then) | ||
: super(_value, (v) => _then(v as _$Custom{{feature_name.pascalCase()}}Event)); | ||
|
||
@override | ||
_$Custom{{feature_name.pascalCase()}}Event get _value => super._value as _$Custom{{feature_name.pascalCase()}}Event; | ||
} | ||
|
||
/// @nodoc | ||
|
||
class _$Custom{{feature_name.pascalCase()}}Event implements Custom{{feature_name.pascalCase()}}Event { | ||
const _$Custom{{feature_name.pascalCase()}}Event(); | ||
|
||
@override | ||
String toString() { | ||
return '{{feature_name.pascalCase()}}Event.event()'; | ||
} | ||
|
||
@override | ||
bool operator ==(dynamic other) { | ||
return identical(this, other) || | ||
(other.runtimeType == runtimeType && other is _$Custom{{feature_name.pascalCase()}}Event); | ||
} | ||
|
||
@override | ||
int get hashCode => runtimeType.hashCode; | ||
|
||
@override | ||
@optionalTypeArgs | ||
TResult when<TResult extends Object?>({ | ||
required TResult Function() event, | ||
}) { | ||
return event(); | ||
} | ||
|
||
@override | ||
@optionalTypeArgs | ||
TResult? whenOrNull<TResult extends Object?>({ | ||
TResult Function()? event, | ||
}) { | ||
return event?.call(); | ||
} | ||
|
||
@override | ||
@optionalTypeArgs | ||
TResult maybeWhen<TResult extends Object?>({ | ||
TResult Function()? event, | ||
required TResult orElse(), | ||
}) { | ||
if (event != null) { | ||
return event(); | ||
} | ||
return orElse(); | ||
} | ||
|
||
@override | ||
@optionalTypeArgs | ||
TResult map<TResult extends Object?>({ | ||
required TResult Function(Custom{{feature_name.pascalCase()}}Event value) event, | ||
}) { | ||
return event(this); | ||
} | ||
|
||
@override | ||
@optionalTypeArgs | ||
TResult? mapOrNull<TResult extends Object?>({ | ||
TResult Function(Custom{{feature_name.pascalCase()}}Event value)? event, | ||
}) { | ||
return event?.call(this); | ||
} | ||
|
||
@override | ||
@optionalTypeArgs | ||
TResult maybeMap<TResult extends Object?>({ | ||
TResult Function(Custom{{feature_name.pascalCase()}}Event value)? event, | ||
required TResult orElse(), | ||
}) { | ||
if (event != null) { | ||
return event(this); | ||
} | ||
return orElse(); | ||
} | ||
} | ||
|
||
abstract class Custom{{feature_name.pascalCase()}}Event implements {{feature_name.pascalCase()}}Event { | ||
const factory Custom{{feature_name.pascalCase()}}Event() = _$Custom{{feature_name.pascalCase()}}Event; | ||
} |
Oops, something went wrong.