Remove unnecessary "this." in insert companion constructor

This commit is contained in:
Simon Binder 2019-08-29 16:33:15 +02:00
parent 241baed0c3
commit 3cb00a4b31
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
4 changed files with 22 additions and 21 deletions

View File

@ -275,8 +275,8 @@ class RecipesCompanion extends UpdateCompanion<Recipe> {
@required String title,
@required String instructions,
this.category = const Value.absent(),
}) : this.title = Value(title),
this.instructions = Value(instructions);
}) : title = Value(title),
instructions = Value(instructions);
RecipesCompanion copyWith(
{Value<int> id,
Value<String> title,
@ -497,8 +497,8 @@ class IngredientsCompanion extends UpdateCompanion<Ingredient> {
this.id = const Value.absent(),
@required String name,
@required int caloriesPer100g,
}) : this.name = Value(name),
this.caloriesPer100g = Value(caloriesPer100g);
}) : name = Value(name),
caloriesPer100g = Value(caloriesPer100g);
IngredientsCompanion copyWith(
{Value<int> id, Value<String> name, Value<int> caloriesPer100g}) {
return IngredientsCompanion(
@ -709,9 +709,9 @@ class IngredientInRecipesCompanion extends UpdateCompanion<IngredientInRecipe> {
@required int recipe,
@required int ingredient,
@required int amountInGrams,
}) : this.recipe = Value(recipe),
this.ingredient = Value(ingredient),
this.amountInGrams = Value(amountInGrams);
}) : recipe = Value(recipe),
ingredient = Value(ingredient),
amountInGrams = Value(amountInGrams);
IngredientInRecipesCompanion copyWith(
{Value<int> recipe, Value<int> ingredient, Value<int> amountInGrams}) {
return IngredientInRecipesCompanion(

View File

@ -65,7 +65,7 @@ class NoIdsCompanion extends UpdateCompanion<NoId> {
});
NoIdsCompanion.insert({
@required Uint8List payload,
}) : this.payload = Value(payload);
}) : payload = Value(payload);
NoIdsCompanion copyWith({Value<Uint8List> payload}) {
return NoIdsCompanion(
payload: payload ?? this.payload,
@ -370,7 +370,7 @@ class WithConstraintsCompanion extends UpdateCompanion<WithConstraint> {
this.a = const Value.absent(),
@required int b,
this.c = const Value.absent(),
}) : this.b = Value(b);
}) : b = Value(b);
WithConstraintsCompanion copyWith(
{Value<String> a, Value<int> b, Value<double> c}) {
return WithConstraintsCompanion(
@ -550,7 +550,7 @@ class ConfigCompanion extends UpdateCompanion<ConfigData> {
ConfigCompanion.insert({
@required String configKey,
this.configValue = const Value.absent(),
}) : this.configKey = Value(configKey);
}) : configKey = Value(configKey);
ConfigCompanion copyWith(
{Value<String> configKey, Value<String> configValue}) {
return ConfigCompanion(

View File

@ -139,7 +139,7 @@ class TodosTableCompanion extends UpdateCompanion<TodoEntry> {
@required String content,
this.targetDate = const Value.absent(),
this.category = const Value.absent(),
}) : this.content = Value(content);
}) : content = Value(content);
TodosTableCompanion copyWith(
{Value<int> id,
Value<String> title,
@ -368,7 +368,7 @@ class CategoriesCompanion extends UpdateCompanion<Category> {
CategoriesCompanion.insert({
this.id = const Value.absent(),
@required String description,
}) : this.description = Value(description);
}) : description = Value(description);
CategoriesCompanion copyWith({Value<int> id, Value<String> description}) {
return CategoriesCompanion(
id: id ?? this.id,
@ -586,8 +586,8 @@ class UsersCompanion extends UpdateCompanion<User> {
this.isAwesome = const Value.absent(),
@required Uint8List profilePicture,
this.creationTime = const Value.absent(),
}) : this.name = Value(name),
this.profilePicture = Value(profilePicture);
}) : name = Value(name),
profilePicture = Value(profilePicture);
UsersCompanion copyWith(
{Value<int> id,
Value<String> name,
@ -814,8 +814,8 @@ class SharedTodosCompanion extends UpdateCompanion<SharedTodo> {
SharedTodosCompanion.insert({
@required int todo,
@required int user,
}) : this.todo = Value(todo),
this.user = Value(user);
}) : todo = Value(todo),
user = Value(user);
SharedTodosCompanion copyWith({Value<int> todo, Value<int> user}) {
return SharedTodosCompanion(
todo: todo ?? this.todo,
@ -1006,9 +1006,9 @@ class TableWithoutPKCompanion extends UpdateCompanion<TableWithoutPKData> {
@required int notReallyAnId,
@required double someFloat,
@required MyCustomObject custom,
}) : this.notReallyAnId = Value(notReallyAnId),
this.someFloat = Value(someFloat),
this.custom = Value(custom);
}) : notReallyAnId = Value(notReallyAnId),
someFloat = Value(someFloat),
custom = Value(custom);
TableWithoutPKCompanion copyWith(
{Value<int> notReallyAnId,
Value<double> someFloat,

View File

@ -50,7 +50,8 @@ class UpdateCompanionWriter {
// .insert({
// @required String a,
// this.b = const Value.absent(),
// @required String b}): this.a = Value(a), this.b = Value(b);
// @required String b}): a = Value(a), b = Value(b);
// We don't need to use this. for the initializers, Dart figures that out.
for (var column in table.columns) {
final param = column.dartGetterName;
@ -75,7 +76,7 @@ class UpdateCompanionWriter {
}
final param = required.dartGetterName;
buffer.write('this.$param = Value($param)');
buffer.write('$param = Value($param)');
}
buffer.write(';\n');