diff --git a/build.yaml b/build.yaml new file mode 100644 index 000000000..4f5dac214 --- /dev/null +++ b/build.yaml @@ -0,0 +1,6 @@ +targets: + $default: + builders: + drift_dev: + options: + store_date_time_values_as_text: true \ No newline at end of file diff --git a/lib/database/exercises/exercise_database.g.dart b/lib/database/exercises/exercise_database.g.dart index a07b1092e..0a90da245 100644 --- a/lib/database/exercises/exercise_database.g.dart +++ b/lib/database/exercises/exercise_database.g.dart @@ -3,7 +3,8 @@ part of 'exercise_database.dart'; // ignore_for_file: type=lint -class $ExercisesTable extends Exercises with TableInfo<$ExercisesTable, ExerciseTable> { +class $ExercisesTable extends Exercises + with TableInfo<$ExercisesTable, ExerciseTable> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -200,8 +201,12 @@ class ExerciseTable extends DataClass implements Insertable { return ExerciseTable( id: data.id.present ? data.id.value : this.id, data: data.data.present ? data.data.value : this.data, - lastUpdate: data.lastUpdate.present ? data.lastUpdate.value : this.lastUpdate, - lastFetched: data.lastFetched.present ? data.lastFetched.value : this.lastFetched, + lastUpdate: data.lastUpdate.present + ? data.lastUpdate.value + : this.lastUpdate, + lastFetched: data.lastFetched.present + ? data.lastFetched.value + : this.lastFetched, ); } @@ -332,13 +337,14 @@ class $MusclesTable extends Muscles with TableInfo<$MusclesTable, MuscleTable> { requiredDuringInsert: true, ); @override - late final GeneratedColumnWithTypeConverter data = GeneratedColumn( - 'data', - aliasedName, - false, - type: DriftSqlType.string, - requiredDuringInsert: true, - ).withConverter($MusclesTable.$converterdata); + late final GeneratedColumnWithTypeConverter data = + GeneratedColumn( + 'data', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ).withConverter($MusclesTable.$converterdata); @override List get $columns => [id, data]; @override @@ -518,7 +524,8 @@ class MusclesCompanion extends UpdateCompanion { } } -class $EquipmentsTable extends Equipments with TableInfo<$EquipmentsTable, EquipmentTable> { +class $EquipmentsTable extends Equipments + with TableInfo<$EquipmentsTable, EquipmentTable> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -533,13 +540,14 @@ class $EquipmentsTable extends Equipments with TableInfo<$EquipmentsTable, Equip requiredDuringInsert: true, ); @override - late final GeneratedColumnWithTypeConverter data = GeneratedColumn( - 'data', - aliasedName, - false, - type: DriftSqlType.string, - requiredDuringInsert: true, - ).withConverter($EquipmentsTable.$converterdata); + late final GeneratedColumnWithTypeConverter data = + GeneratedColumn( + 'data', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ).withConverter($EquipmentsTable.$converterdata); @override List get $columns => [id, data]; @override @@ -586,7 +594,8 @@ class $EquipmentsTable extends Equipments with TableInfo<$EquipmentsTable, Equip return $EquipmentsTable(attachedDatabase, alias); } - static TypeConverter $converterdata = const EquipmentConverter(); + static TypeConverter $converterdata = + const EquipmentConverter(); } class EquipmentTable extends DataClass implements Insertable { @@ -651,7 +660,9 @@ class EquipmentTable extends DataClass implements Insertable { @override bool operator ==(Object other) => identical(this, other) || - (other is EquipmentTable && other.id == this.id && other.data == this.data); + (other is EquipmentTable && + other.id == this.id && + other.data == this.data); } class EquipmentsCompanion extends UpdateCompanion { @@ -721,7 +732,8 @@ class EquipmentsCompanion extends UpdateCompanion { } } -class $CategoriesTable extends Categories with TableInfo<$CategoriesTable, CategoryTable> { +class $CategoriesTable extends Categories + with TableInfo<$CategoriesTable, CategoryTable> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -790,7 +802,8 @@ class $CategoriesTable extends Categories with TableInfo<$CategoriesTable, Categ return $CategoriesTable(attachedDatabase, alias); } - static TypeConverter $converterdata = const ExerciseCategoryConverter(); + static TypeConverter $converterdata = + const ExerciseCategoryConverter(); } class CategoryTable extends DataClass implements Insertable { @@ -855,7 +868,9 @@ class CategoryTable extends DataClass implements Insertable { @override bool operator ==(Object other) => identical(this, other) || - (other is CategoryTable && other.id == this.id && other.data == this.data); + (other is CategoryTable && + other.id == this.id && + other.data == this.data); } class CategoriesCompanion extends UpdateCompanion { @@ -925,7 +940,8 @@ class CategoriesCompanion extends UpdateCompanion { } } -class $LanguagesTable extends Languages with TableInfo<$LanguagesTable, LanguagesTable> { +class $LanguagesTable extends Languages + with TableInfo<$LanguagesTable, LanguagesTable> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -940,13 +956,14 @@ class $LanguagesTable extends Languages with TableInfo<$LanguagesTable, Language requiredDuringInsert: true, ); @override - late final GeneratedColumnWithTypeConverter data = GeneratedColumn( - 'data', - aliasedName, - false, - type: DriftSqlType.string, - requiredDuringInsert: true, - ).withConverter($LanguagesTable.$converterdata); + late final GeneratedColumnWithTypeConverter data = + GeneratedColumn( + 'data', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ).withConverter($LanguagesTable.$converterdata); @override List get $columns => [id, data]; @override @@ -993,7 +1010,8 @@ class $LanguagesTable extends Languages with TableInfo<$LanguagesTable, Language return $LanguagesTable(attachedDatabase, alias); } - static TypeConverter $converterdata = const LanguageConverter(); + static TypeConverter $converterdata = + const LanguageConverter(); } class LanguagesTable extends DataClass implements Insertable { @@ -1058,7 +1076,9 @@ class LanguagesTable extends DataClass implements Insertable { @override bool operator ==(Object other) => identical(this, other) || - (other is LanguagesTable && other.id == this.id && other.data == this.data); + (other is LanguagesTable && + other.id == this.id && + other.data == this.data); } class LanguagesCompanion extends UpdateCompanion { @@ -1147,6 +1167,9 @@ abstract class _$ExerciseDatabase extends GeneratedDatabase { categories, languages, ]; + @override + DriftDatabaseOptions get options => + const DriftDatabaseOptions(storeDateTimeAsText: true); } typedef $$ExercisesTableCreateCompanionBuilder = @@ -1166,7 +1189,8 @@ typedef $$ExercisesTableUpdateCompanionBuilder = Value rowid, }); -class $$ExercisesTableFilterComposer extends Composer<_$ExerciseDatabase, $ExercisesTable> { +class $$ExercisesTableFilterComposer + extends Composer<_$ExerciseDatabase, $ExercisesTable> { $$ExercisesTableFilterComposer({ required super.$db, required super.$table, @@ -1195,7 +1219,8 @@ class $$ExercisesTableFilterComposer extends Composer<_$ExerciseDatabase, $Exerc ); } -class $$ExercisesTableOrderingComposer extends Composer<_$ExerciseDatabase, $ExercisesTable> { +class $$ExercisesTableOrderingComposer + extends Composer<_$ExerciseDatabase, $ExercisesTable> { $$ExercisesTableOrderingComposer({ required super.$db, required super.$table, @@ -1224,7 +1249,8 @@ class $$ExercisesTableOrderingComposer extends Composer<_$ExerciseDatabase, $Exe ); } -class $$ExercisesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $ExercisesTable> { +class $$ExercisesTableAnnotationComposer + extends Composer<_$ExerciseDatabase, $ExercisesTable> { $$ExercisesTableAnnotationComposer({ required super.$db, required super.$table, @@ -1232,7 +1258,8 @@ class $$ExercisesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $E super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); GeneratedColumn get data => $composableBuilder(column: $table.data, builder: (column) => column); @@ -1259,7 +1286,10 @@ class $$ExercisesTableTableManager $$ExercisesTableAnnotationComposer, $$ExercisesTableCreateCompanionBuilder, $$ExercisesTableUpdateCompanionBuilder, - (ExerciseTable, BaseReferences<_$ExerciseDatabase, $ExercisesTable, ExerciseTable>), + ( + ExerciseTable, + BaseReferences<_$ExerciseDatabase, $ExercisesTable, ExerciseTable>, + ), ExerciseTable, PrefetchHooks Function() > { @@ -1268,8 +1298,10 @@ class $$ExercisesTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$ExercisesTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$ExercisesTableOrderingComposer($db: db, $table: table), + createFilteringComposer: () => + $$ExercisesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$ExercisesTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $$ExercisesTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: @@ -1300,8 +1332,9 @@ class $$ExercisesTableTableManager lastFetched: lastFetched, rowid: rowid, ), - withReferenceMapper: (p0) => - p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -1317,7 +1350,10 @@ typedef $$ExercisesTableProcessedTableManager = $$ExercisesTableAnnotationComposer, $$ExercisesTableCreateCompanionBuilder, $$ExercisesTableUpdateCompanionBuilder, - (ExerciseTable, BaseReferences<_$ExerciseDatabase, $ExercisesTable, ExerciseTable>), + ( + ExerciseTable, + BaseReferences<_$ExerciseDatabase, $ExercisesTable, ExerciseTable>, + ), ExerciseTable, PrefetchHooks Function() >; @@ -1334,7 +1370,8 @@ typedef $$MusclesTableUpdateCompanionBuilder = Value rowid, }); -class $$MusclesTableFilterComposer extends Composer<_$ExerciseDatabase, $MusclesTable> { +class $$MusclesTableFilterComposer + extends Composer<_$ExerciseDatabase, $MusclesTable> { $$MusclesTableFilterComposer({ required super.$db, required super.$table, @@ -1347,13 +1384,15 @@ class $$MusclesTableFilterComposer extends Composer<_$ExerciseDatabase, $Muscles builder: (column) => ColumnFilters(column), ); - ColumnWithTypeConverterFilters get data => $composableBuilder( - column: $table.data, - builder: (column) => ColumnWithTypeConverterFilters(column), - ); + ColumnWithTypeConverterFilters get data => + $composableBuilder( + column: $table.data, + builder: (column) => ColumnWithTypeConverterFilters(column), + ); } -class $$MusclesTableOrderingComposer extends Composer<_$ExerciseDatabase, $MusclesTable> { +class $$MusclesTableOrderingComposer + extends Composer<_$ExerciseDatabase, $MusclesTable> { $$MusclesTableOrderingComposer({ required super.$db, required super.$table, @@ -1372,7 +1411,8 @@ class $$MusclesTableOrderingComposer extends Composer<_$ExerciseDatabase, $Muscl ); } -class $$MusclesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $MusclesTable> { +class $$MusclesTableAnnotationComposer + extends Composer<_$ExerciseDatabase, $MusclesTable> { $$MusclesTableAnnotationComposer({ required super.$db, required super.$table, @@ -1380,7 +1420,8 @@ class $$MusclesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $Mus super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); GeneratedColumnWithTypeConverter get data => $composableBuilder(column: $table.data, builder: (column) => column); @@ -1397,7 +1438,10 @@ class $$MusclesTableTableManager $$MusclesTableAnnotationComposer, $$MusclesTableCreateCompanionBuilder, $$MusclesTableUpdateCompanionBuilder, - (MuscleTable, BaseReferences<_$ExerciseDatabase, $MusclesTable, MuscleTable>), + ( + MuscleTable, + BaseReferences<_$ExerciseDatabase, $MusclesTable, MuscleTable>, + ), MuscleTable, PrefetchHooks Function() > { @@ -1406,8 +1450,10 @@ class $$MusclesTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$MusclesTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$MusclesTableOrderingComposer($db: db, $table: table), + createFilteringComposer: () => + $$MusclesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$MusclesTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $$MusclesTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: @@ -1422,8 +1468,9 @@ class $$MusclesTableTableManager required Muscle data, Value rowid = const Value.absent(), }) => MusclesCompanion.insert(id: id, data: data, rowid: rowid), - withReferenceMapper: (p0) => - p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -1439,7 +1486,10 @@ typedef $$MusclesTableProcessedTableManager = $$MusclesTableAnnotationComposer, $$MusclesTableCreateCompanionBuilder, $$MusclesTableUpdateCompanionBuilder, - (MuscleTable, BaseReferences<_$ExerciseDatabase, $MusclesTable, MuscleTable>), + ( + MuscleTable, + BaseReferences<_$ExerciseDatabase, $MusclesTable, MuscleTable>, + ), MuscleTable, PrefetchHooks Function() >; @@ -1456,7 +1506,8 @@ typedef $$EquipmentsTableUpdateCompanionBuilder = Value rowid, }); -class $$EquipmentsTableFilterComposer extends Composer<_$ExerciseDatabase, $EquipmentsTable> { +class $$EquipmentsTableFilterComposer + extends Composer<_$ExerciseDatabase, $EquipmentsTable> { $$EquipmentsTableFilterComposer({ required super.$db, required super.$table, @@ -1469,13 +1520,15 @@ class $$EquipmentsTableFilterComposer extends Composer<_$ExerciseDatabase, $Equi builder: (column) => ColumnFilters(column), ); - ColumnWithTypeConverterFilters get data => $composableBuilder( - column: $table.data, - builder: (column) => ColumnWithTypeConverterFilters(column), - ); + ColumnWithTypeConverterFilters get data => + $composableBuilder( + column: $table.data, + builder: (column) => ColumnWithTypeConverterFilters(column), + ); } -class $$EquipmentsTableOrderingComposer extends Composer<_$ExerciseDatabase, $EquipmentsTable> { +class $$EquipmentsTableOrderingComposer + extends Composer<_$ExerciseDatabase, $EquipmentsTable> { $$EquipmentsTableOrderingComposer({ required super.$db, required super.$table, @@ -1494,7 +1547,8 @@ class $$EquipmentsTableOrderingComposer extends Composer<_$ExerciseDatabase, $Eq ); } -class $$EquipmentsTableAnnotationComposer extends Composer<_$ExerciseDatabase, $EquipmentsTable> { +class $$EquipmentsTableAnnotationComposer + extends Composer<_$ExerciseDatabase, $EquipmentsTable> { $$EquipmentsTableAnnotationComposer({ required super.$db, required super.$table, @@ -1502,7 +1556,8 @@ class $$EquipmentsTableAnnotationComposer extends Composer<_$ExerciseDatabase, $ super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); GeneratedColumnWithTypeConverter get data => $composableBuilder(column: $table.data, builder: (column) => column); @@ -1519,7 +1574,14 @@ class $$EquipmentsTableTableManager $$EquipmentsTableAnnotationComposer, $$EquipmentsTableCreateCompanionBuilder, $$EquipmentsTableUpdateCompanionBuilder, - (EquipmentTable, BaseReferences<_$ExerciseDatabase, $EquipmentsTable, EquipmentTable>), + ( + EquipmentTable, + BaseReferences< + _$ExerciseDatabase, + $EquipmentsTable, + EquipmentTable + >, + ), EquipmentTable, PrefetchHooks Function() > { @@ -1528,8 +1590,10 @@ class $$EquipmentsTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$EquipmentsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$EquipmentsTableOrderingComposer($db: db, $table: table), + createFilteringComposer: () => + $$EquipmentsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$EquipmentsTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $$EquipmentsTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: @@ -1543,9 +1607,11 @@ class $$EquipmentsTableTableManager required int id, required Equipment data, Value rowid = const Value.absent(), - }) => EquipmentsCompanion.insert(id: id, data: data, rowid: rowid), - withReferenceMapper: (p0) => - p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + }) => + EquipmentsCompanion.insert(id: id, data: data, rowid: rowid), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -1561,7 +1627,10 @@ typedef $$EquipmentsTableProcessedTableManager = $$EquipmentsTableAnnotationComposer, $$EquipmentsTableCreateCompanionBuilder, $$EquipmentsTableUpdateCompanionBuilder, - (EquipmentTable, BaseReferences<_$ExerciseDatabase, $EquipmentsTable, EquipmentTable>), + ( + EquipmentTable, + BaseReferences<_$ExerciseDatabase, $EquipmentsTable, EquipmentTable>, + ), EquipmentTable, PrefetchHooks Function() >; @@ -1578,7 +1647,8 @@ typedef $$CategoriesTableUpdateCompanionBuilder = Value rowid, }); -class $$CategoriesTableFilterComposer extends Composer<_$ExerciseDatabase, $CategoriesTable> { +class $$CategoriesTableFilterComposer + extends Composer<_$ExerciseDatabase, $CategoriesTable> { $$CategoriesTableFilterComposer({ required super.$db, required super.$table, @@ -1591,14 +1661,15 @@ class $$CategoriesTableFilterComposer extends Composer<_$ExerciseDatabase, $Cate builder: (column) => ColumnFilters(column), ); - ColumnWithTypeConverterFilters get data => - $composableBuilder( - column: $table.data, - builder: (column) => ColumnWithTypeConverterFilters(column), - ); + ColumnWithTypeConverterFilters + get data => $composableBuilder( + column: $table.data, + builder: (column) => ColumnWithTypeConverterFilters(column), + ); } -class $$CategoriesTableOrderingComposer extends Composer<_$ExerciseDatabase, $CategoriesTable> { +class $$CategoriesTableOrderingComposer + extends Composer<_$ExerciseDatabase, $CategoriesTable> { $$CategoriesTableOrderingComposer({ required super.$db, required super.$table, @@ -1617,7 +1688,8 @@ class $$CategoriesTableOrderingComposer extends Composer<_$ExerciseDatabase, $Ca ); } -class $$CategoriesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $CategoriesTable> { +class $$CategoriesTableAnnotationComposer + extends Composer<_$ExerciseDatabase, $CategoriesTable> { $$CategoriesTableAnnotationComposer({ required super.$db, required super.$table, @@ -1625,7 +1697,8 @@ class $$CategoriesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $ super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); GeneratedColumnWithTypeConverter get data => $composableBuilder(column: $table.data, builder: (column) => column); @@ -1642,7 +1715,10 @@ class $$CategoriesTableTableManager $$CategoriesTableAnnotationComposer, $$CategoriesTableCreateCompanionBuilder, $$CategoriesTableUpdateCompanionBuilder, - (CategoryTable, BaseReferences<_$ExerciseDatabase, $CategoriesTable, CategoryTable>), + ( + CategoryTable, + BaseReferences<_$ExerciseDatabase, $CategoriesTable, CategoryTable>, + ), CategoryTable, PrefetchHooks Function() > { @@ -1651,8 +1727,10 @@ class $$CategoriesTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$CategoriesTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$CategoriesTableOrderingComposer($db: db, $table: table), + createFilteringComposer: () => + $$CategoriesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CategoriesTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $$CategoriesTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: @@ -1666,9 +1744,11 @@ class $$CategoriesTableTableManager required int id, required ExerciseCategory data, Value rowid = const Value.absent(), - }) => CategoriesCompanion.insert(id: id, data: data, rowid: rowid), - withReferenceMapper: (p0) => - p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + }) => + CategoriesCompanion.insert(id: id, data: data, rowid: rowid), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -1684,7 +1764,10 @@ typedef $$CategoriesTableProcessedTableManager = $$CategoriesTableAnnotationComposer, $$CategoriesTableCreateCompanionBuilder, $$CategoriesTableUpdateCompanionBuilder, - (CategoryTable, BaseReferences<_$ExerciseDatabase, $CategoriesTable, CategoryTable>), + ( + CategoryTable, + BaseReferences<_$ExerciseDatabase, $CategoriesTable, CategoryTable>, + ), CategoryTable, PrefetchHooks Function() >; @@ -1701,7 +1784,8 @@ typedef $$LanguagesTableUpdateCompanionBuilder = Value rowid, }); -class $$LanguagesTableFilterComposer extends Composer<_$ExerciseDatabase, $LanguagesTable> { +class $$LanguagesTableFilterComposer + extends Composer<_$ExerciseDatabase, $LanguagesTable> { $$LanguagesTableFilterComposer({ required super.$db, required super.$table, @@ -1714,13 +1798,15 @@ class $$LanguagesTableFilterComposer extends Composer<_$ExerciseDatabase, $Langu builder: (column) => ColumnFilters(column), ); - ColumnWithTypeConverterFilters get data => $composableBuilder( - column: $table.data, - builder: (column) => ColumnWithTypeConverterFilters(column), - ); + ColumnWithTypeConverterFilters get data => + $composableBuilder( + column: $table.data, + builder: (column) => ColumnWithTypeConverterFilters(column), + ); } -class $$LanguagesTableOrderingComposer extends Composer<_$ExerciseDatabase, $LanguagesTable> { +class $$LanguagesTableOrderingComposer + extends Composer<_$ExerciseDatabase, $LanguagesTable> { $$LanguagesTableOrderingComposer({ required super.$db, required super.$table, @@ -1739,7 +1825,8 @@ class $$LanguagesTableOrderingComposer extends Composer<_$ExerciseDatabase, $Lan ); } -class $$LanguagesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $LanguagesTable> { +class $$LanguagesTableAnnotationComposer + extends Composer<_$ExerciseDatabase, $LanguagesTable> { $$LanguagesTableAnnotationComposer({ required super.$db, required super.$table, @@ -1747,7 +1834,8 @@ class $$LanguagesTableAnnotationComposer extends Composer<_$ExerciseDatabase, $L super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); GeneratedColumnWithTypeConverter get data => $composableBuilder(column: $table.data, builder: (column) => column); @@ -1764,7 +1852,10 @@ class $$LanguagesTableTableManager $$LanguagesTableAnnotationComposer, $$LanguagesTableCreateCompanionBuilder, $$LanguagesTableUpdateCompanionBuilder, - (LanguagesTable, BaseReferences<_$ExerciseDatabase, $LanguagesTable, LanguagesTable>), + ( + LanguagesTable, + BaseReferences<_$ExerciseDatabase, $LanguagesTable, LanguagesTable>, + ), LanguagesTable, PrefetchHooks Function() > { @@ -1773,8 +1864,10 @@ class $$LanguagesTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$LanguagesTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$LanguagesTableOrderingComposer($db: db, $table: table), + createFilteringComposer: () => + $$LanguagesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$LanguagesTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $$LanguagesTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: @@ -1789,8 +1882,9 @@ class $$LanguagesTableTableManager required Language data, Value rowid = const Value.absent(), }) => LanguagesCompanion.insert(id: id, data: data, rowid: rowid), - withReferenceMapper: (p0) => - p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -1806,7 +1900,10 @@ typedef $$LanguagesTableProcessedTableManager = $$LanguagesTableAnnotationComposer, $$LanguagesTableCreateCompanionBuilder, $$LanguagesTableUpdateCompanionBuilder, - (LanguagesTable, BaseReferences<_$ExerciseDatabase, $LanguagesTable, LanguagesTable>), + ( + LanguagesTable, + BaseReferences<_$ExerciseDatabase, $LanguagesTable, LanguagesTable>, + ), LanguagesTable, PrefetchHooks Function() >; @@ -1814,11 +1911,14 @@ typedef $$LanguagesTableProcessedTableManager = class $ExerciseDatabaseManager { final _$ExerciseDatabase _db; $ExerciseDatabaseManager(this._db); - $$ExercisesTableTableManager get exercises => $$ExercisesTableTableManager(_db, _db.exercises); - $$MusclesTableTableManager get muscles => $$MusclesTableTableManager(_db, _db.muscles); + $$ExercisesTableTableManager get exercises => + $$ExercisesTableTableManager(_db, _db.exercises); + $$MusclesTableTableManager get muscles => + $$MusclesTableTableManager(_db, _db.muscles); $$EquipmentsTableTableManager get equipments => $$EquipmentsTableTableManager(_db, _db.equipments); $$CategoriesTableTableManager get categories => $$CategoriesTableTableManager(_db, _db.categories); - $$LanguagesTableTableManager get languages => $$LanguagesTableTableManager(_db, _db.languages); + $$LanguagesTableTableManager get languages => + $$LanguagesTableTableManager(_db, _db.languages); } diff --git a/lib/database/ingredients/ingredients_database.g.dart b/lib/database/ingredients/ingredients_database.g.dart index 7dc02ac32..411f55502 100644 --- a/lib/database/ingredients/ingredients_database.g.dart +++ b/lib/database/ingredients/ingredients_database.g.dart @@ -3,7 +3,8 @@ part of 'ingredients_database.dart'; // ignore_for_file: type=lint -class $IngredientsTable extends Ingredients with TableInfo<$IngredientsTable, IngredientTable> { +class $IngredientsTable extends Ingredients + with TableInfo<$IngredientsTable, IngredientTable> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -154,16 +155,19 @@ class IngredientTable extends DataClass implements Insertable { }; } - IngredientTable copyWith({int? id, String? data, DateTime? lastFetched}) => IngredientTable( - id: id ?? this.id, - data: data ?? this.data, - lastFetched: lastFetched ?? this.lastFetched, - ); + IngredientTable copyWith({int? id, String? data, DateTime? lastFetched}) => + IngredientTable( + id: id ?? this.id, + data: data ?? this.data, + lastFetched: lastFetched ?? this.lastFetched, + ); IngredientTable copyWithCompanion(IngredientsCompanion data) { return IngredientTable( id: data.id.present ? data.id.value : this.id, data: data.data.present ? data.data.value : this.data, - lastFetched: data.lastFetched.present ? data.lastFetched.value : this.lastFetched, + lastFetched: data.lastFetched.present + ? data.lastFetched.value + : this.lastFetched, ); } @@ -274,6 +278,9 @@ abstract class _$IngredientDatabase extends GeneratedDatabase { allSchemaEntities.whereType>(); @override List get allSchemaEntities => [ingredients]; + @override + DriftDatabaseOptions get options => + const DriftDatabaseOptions(storeDateTimeAsText: true); } typedef $$IngredientsTableCreateCompanionBuilder = @@ -291,7 +298,8 @@ typedef $$IngredientsTableUpdateCompanionBuilder = Value rowid, }); -class $$IngredientsTableFilterComposer extends Composer<_$IngredientDatabase, $IngredientsTable> { +class $$IngredientsTableFilterComposer + extends Composer<_$IngredientDatabase, $IngredientsTable> { $$IngredientsTableFilterComposer({ required super.$db, required super.$table, @@ -315,7 +323,8 @@ class $$IngredientsTableFilterComposer extends Composer<_$IngredientDatabase, $I ); } -class $$IngredientsTableOrderingComposer extends Composer<_$IngredientDatabase, $IngredientsTable> { +class $$IngredientsTableOrderingComposer + extends Composer<_$IngredientDatabase, $IngredientsTable> { $$IngredientsTableOrderingComposer({ required super.$db, required super.$table, @@ -348,7 +357,8 @@ class $$IngredientsTableAnnotationComposer super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); GeneratedColumn get data => $composableBuilder(column: $table.data, builder: (column) => column); @@ -372,7 +382,11 @@ class $$IngredientsTableTableManager $$IngredientsTableUpdateCompanionBuilder, ( IngredientTable, - BaseReferences<_$IngredientDatabase, $IngredientsTable, IngredientTable>, + BaseReferences< + _$IngredientDatabase, + $IngredientsTable, + IngredientTable + >, ), IngredientTable, PrefetchHooks Function() @@ -384,8 +398,10 @@ class $$IngredientsTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$IngredientsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$IngredientsTableOrderingComposer($db: db, $table: table), + createFilteringComposer: () => + $$IngredientsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$IngredientsTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $$IngredientsTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: @@ -412,8 +428,9 @@ class $$IngredientsTableTableManager lastFetched: lastFetched, rowid: rowid, ), - withReferenceMapper: (p0) => - p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -429,7 +446,14 @@ typedef $$IngredientsTableProcessedTableManager = $$IngredientsTableAnnotationComposer, $$IngredientsTableCreateCompanionBuilder, $$IngredientsTableUpdateCompanionBuilder, - (IngredientTable, BaseReferences<_$IngredientDatabase, $IngredientsTable, IngredientTable>), + ( + IngredientTable, + BaseReferences< + _$IngredientDatabase, + $IngredientsTable, + IngredientTable + >, + ), IngredientTable, PrefetchHooks Function() >; diff --git a/lib/database/powersync/database.dart b/lib/database/powersync/database.dart new file mode 100644 index 000000000..95821918f --- /dev/null +++ b/lib/database/powersync/database.dart @@ -0,0 +1,53 @@ +import 'package:drift/drift.dart'; +import 'package:drift_sqlite_async/drift_sqlite_async.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:powersync/powersync.dart' show uuid; +import 'package:wger/database/weight/database.dart'; +import 'package:wger/models/body_weight/weight_entry.dart'; + +import 'powersync.dart'; + +part 'database.g.dart'; + +@DriftDatabase( + tables: [ + WeightEntryTable, + ], + //include: {'queries.drift'}, +) +class AppDatabase extends _$AppDatabase { + AppDatabase(super.e); + + @override + int get schemaVersion => 1; + + @override + MigrationStrategy get migration { + return MigrationStrategy( + onCreate: (m) async { + // We don't have to call createAll(), PowerSync instantiates the schema + // for us. We can use the opportunity to create fts5 indexes though. + }, + onUpgrade: (m, from, to) async { + if (from == 1) { + // await createFts5Tables( + // db: this, + // tableName: 'todos', + // columns: ['description', 'list_id'], + // ); + } + }, + ); + } +} + +final driftPowerSyncDatabase = Provider((ref) { + return AppDatabase( + DatabaseConnection.delayed( + Future(() async { + final database = await ref.read(powerSyncInstanceProvider.future); + return SqliteAsyncDriftConnection(database); + }), + ), + ); +}); diff --git a/lib/database/powersync/database.g.dart b/lib/database/powersync/database.g.dart new file mode 100644 index 000000000..24c9d6a52 --- /dev/null +++ b/lib/database/powersync/database.g.dart @@ -0,0 +1,362 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'database.dart'; + +// ignore_for_file: type=lint +class $WeightEntryTableTable extends WeightEntryTable + with TableInfo<$WeightEntryTableTable, WeightEntry> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $WeightEntryTableTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: false, + clientDefault: () => uuid.v4(), + ); + static const VerificationMeta _weightMeta = const VerificationMeta('weight'); + @override + late final GeneratedColumn weight = GeneratedColumn( + 'weight', + aliasedName, + false, + type: DriftSqlType.double, + requiredDuringInsert: true, + ); + static const VerificationMeta _dateMeta = const VerificationMeta('date'); + @override + late final GeneratedColumn date = GeneratedColumn( + 'date', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + @override + List get $columns => [id, weight, date]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'weight_weightentry'; + @override + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { + final context = VerificationContext(); + final data = instance.toColumns(true); + if (data.containsKey('id')) { + context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); + } + if (data.containsKey('weight')) { + context.handle( + _weightMeta, + weight.isAcceptableOrUnknown(data['weight']!, _weightMeta), + ); + } else if (isInserting) { + context.missing(_weightMeta); + } + if (data.containsKey('date')) { + context.handle( + _dateMeta, + date.isAcceptableOrUnknown(data['date']!, _dateMeta), + ); + } + return context; + } + + @override + Set get $primaryKey => const {}; + @override + WeightEntry map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return WeightEntry( + id: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}id'], + )!, + weight: attachedDatabase.typeMapping.read( + DriftSqlType.double, + data['${effectivePrefix}weight'], + )!, + date: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}date'], + ), + ); + } + + @override + $WeightEntryTableTable createAlias(String alias) { + return $WeightEntryTableTable(attachedDatabase, alias); + } +} + +class WeightEntryTableCompanion extends UpdateCompanion { + final Value id; + final Value weight; + final Value date; + final Value rowid; + const WeightEntryTableCompanion({ + this.id = const Value.absent(), + this.weight = const Value.absent(), + this.date = const Value.absent(), + this.rowid = const Value.absent(), + }); + WeightEntryTableCompanion.insert({ + this.id = const Value.absent(), + required double weight, + this.date = const Value.absent(), + this.rowid = const Value.absent(), + }) : weight = Value(weight); + static Insertable custom({ + Expression? id, + Expression? weight, + Expression? date, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (weight != null) 'weight': weight, + if (date != null) 'date': date, + if (rowid != null) 'rowid': rowid, + }); + } + + WeightEntryTableCompanion copyWith({ + Value? id, + Value? weight, + Value? date, + Value? rowid, + }) { + return WeightEntryTableCompanion( + id: id ?? this.id, + weight: weight ?? this.weight, + date: date ?? this.date, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (weight.present) { + map['weight'] = Variable(weight.value); + } + if (date.present) { + map['date'] = Variable(date.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('WeightEntryTableCompanion(') + ..write('id: $id, ') + ..write('weight: $weight, ') + ..write('date: $date, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +abstract class _$AppDatabase extends GeneratedDatabase { + _$AppDatabase(QueryExecutor e) : super(e); + $AppDatabaseManager get managers => $AppDatabaseManager(this); + late final $WeightEntryTableTable weightEntryTable = $WeightEntryTableTable( + this, + ); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [weightEntryTable]; + @override + DriftDatabaseOptions get options => + const DriftDatabaseOptions(storeDateTimeAsText: true); +} + +typedef $$WeightEntryTableTableCreateCompanionBuilder = + WeightEntryTableCompanion Function({ + Value id, + required double weight, + Value date, + Value rowid, + }); +typedef $$WeightEntryTableTableUpdateCompanionBuilder = + WeightEntryTableCompanion Function({ + Value id, + Value weight, + Value date, + Value rowid, + }); + +class $$WeightEntryTableTableFilterComposer + extends Composer<_$AppDatabase, $WeightEntryTableTable> { + $$WeightEntryTableTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get weight => $composableBuilder( + column: $table.weight, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get date => $composableBuilder( + column: $table.date, + builder: (column) => ColumnFilters(column), + ); +} + +class $$WeightEntryTableTableOrderingComposer + extends Composer<_$AppDatabase, $WeightEntryTableTable> { + $$WeightEntryTableTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get weight => $composableBuilder( + column: $table.weight, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get date => $composableBuilder( + column: $table.date, + builder: (column) => ColumnOrderings(column), + ); +} + +class $$WeightEntryTableTableAnnotationComposer + extends Composer<_$AppDatabase, $WeightEntryTableTable> { + $$WeightEntryTableTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get weight => + $composableBuilder(column: $table.weight, builder: (column) => column); + + GeneratedColumn get date => + $composableBuilder(column: $table.date, builder: (column) => column); +} + +class $$WeightEntryTableTableTableManager + extends + RootTableManager< + _$AppDatabase, + $WeightEntryTableTable, + WeightEntry, + $$WeightEntryTableTableFilterComposer, + $$WeightEntryTableTableOrderingComposer, + $$WeightEntryTableTableAnnotationComposer, + $$WeightEntryTableTableCreateCompanionBuilder, + $$WeightEntryTableTableUpdateCompanionBuilder, + ( + WeightEntry, + BaseReferences<_$AppDatabase, $WeightEntryTableTable, WeightEntry>, + ), + WeightEntry, + PrefetchHooks Function() + > { + $$WeightEntryTableTableTableManager( + _$AppDatabase db, + $WeightEntryTableTable table, + ) : super( + TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$WeightEntryTableTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$WeightEntryTableTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$WeightEntryTableTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: + ({ + Value id = const Value.absent(), + Value weight = const Value.absent(), + Value date = const Value.absent(), + Value rowid = const Value.absent(), + }) => WeightEntryTableCompanion( + id: id, + weight: weight, + date: date, + rowid: rowid, + ), + createCompanionCallback: + ({ + Value id = const Value.absent(), + required double weight, + Value date = const Value.absent(), + Value rowid = const Value.absent(), + }) => WeightEntryTableCompanion.insert( + id: id, + weight: weight, + date: date, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + ), + ); +} + +typedef $$WeightEntryTableTableProcessedTableManager = + ProcessedTableManager< + _$AppDatabase, + $WeightEntryTableTable, + WeightEntry, + $$WeightEntryTableTableFilterComposer, + $$WeightEntryTableTableOrderingComposer, + $$WeightEntryTableTableAnnotationComposer, + $$WeightEntryTableTableCreateCompanionBuilder, + $$WeightEntryTableTableUpdateCompanionBuilder, + ( + WeightEntry, + BaseReferences<_$AppDatabase, $WeightEntryTableTable, WeightEntry>, + ), + WeightEntry, + PrefetchHooks Function() + >; + +class $AppDatabaseManager { + final _$AppDatabase _db; + $AppDatabaseManager(this._db); + $$WeightEntryTableTableTableManager get weightEntryTable => + $$WeightEntryTableTableTableManager(_db, _db.weightEntryTable); +} diff --git a/lib/database/powersync/powersync.dart b/lib/database/powersync/powersync.dart new file mode 100644 index 000000000..04d9026cd --- /dev/null +++ b/lib/database/powersync/powersync.dart @@ -0,0 +1,79 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:path/path.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:powersync/powersync.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; +import 'package:stream_transform/stream_transform.dart'; +import 'package:wger/powersync/connector.dart'; +import 'package:wger/powersync/schema.dart'; + +part 'powersync.g.dart'; + +@Riverpod(keepAlive: true) +Future powerSyncInstance(Ref ref) async { + final db = PowerSyncDatabase( + schema: schema, + path: await _getDatabasePath(), + logger: attachedLogger, + ); + await db.initialize(); + + DjangoConnector? currentConnector; + currentConnector = DjangoConnector(); + db.connect(connector: currentConnector); + + // if (ref.read(sessionProvider).value != null) { + // currentConnector = DjangoConnector(); + // db.connect(connector: currentConnector); + // } + + // final instance = Supabase.instance.client.auth; + // final sub = instance.onAuthStateChange.listen((data) async { + // final event = data.event; + // if (event == AuthChangeEvent.signedIn) { + // currentConnector = DjangoConnector(); + // db.connect(connector: currentConnector!); + // } else if (event == AuthChangeEvent.signedOut) { + // currentConnector = null; + // await db.disconnect(); + // } else if (event == AuthChangeEvent.tokenRefreshed) { + // currentConnector?.prefetchCredentials(); + // } + // }); + // ref.onDispose(sub.cancel); + ref.onDispose(db.close); + + return db; +} + +final _syncStatusInternal = StreamProvider((ref) { + return Stream.fromFuture( + ref.watch(powerSyncInstanceProvider.future), + ).asyncExpand((db) => db.statusStream).startWith(null); +}); + +final syncStatus = Provider((ref) { + // ignore: invalid_use_of_internal_member + return ref.watch(_syncStatusInternal).value ?? const SyncStatus(); +}); + +@riverpod +bool didCompleteSync(Ref ref, [StreamPriority? priority]) { + final status = ref.watch(syncStatus); + if (priority != null) { + return status.statusForPriority(priority).hasSynced ?? false; + } else { + return status.hasSynced ?? false; + } +} + +Future _getDatabasePath() async { + const dbFilename = 'powersync-demo.db'; + // getApplicationSupportDirectory is not supported on Web + if (kIsWeb) { + return dbFilename; + } + final dir = await getApplicationSupportDirectory(); + return join(dir.path, dbFilename); +} diff --git a/lib/database/powersync/powersync.g.dart b/lib/database/powersync/powersync.g.dart new file mode 100644 index 000000000..ee9b4fac1 --- /dev/null +++ b/lib/database/powersync/powersync.g.dart @@ -0,0 +1,124 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'powersync.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(powerSyncInstance) +const powerSyncInstanceProvider = PowerSyncInstanceProvider._(); + +final class PowerSyncInstanceProvider + extends + $FunctionalProvider< + AsyncValue, + PowerSyncDatabase, + FutureOr + > + with $FutureModifier, $FutureProvider { + const PowerSyncInstanceProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'powerSyncInstanceProvider', + isAutoDispose: false, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$powerSyncInstanceHash(); + + @$internal + @override + $FutureProviderElement $createElement( + $ProviderPointer pointer, + ) => $FutureProviderElement(pointer); + + @override + FutureOr create(Ref ref) { + return powerSyncInstance(ref); + } +} + +String _$powerSyncInstanceHash() => r'2327baf23a05ca82fd26376256fe824ea07e5740'; + +@ProviderFor(didCompleteSync) +const didCompleteSyncProvider = DidCompleteSyncFamily._(); + +final class DidCompleteSyncProvider extends $FunctionalProvider + with $Provider { + const DidCompleteSyncProvider._({ + required DidCompleteSyncFamily super.from, + required StreamPriority? super.argument, + }) : super( + retry: null, + name: r'didCompleteSyncProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$didCompleteSyncHash(); + + @override + String toString() { + return r'didCompleteSyncProvider' + '' + '($argument)'; + } + + @$internal + @override + $ProviderElement $createElement($ProviderPointer pointer) => $ProviderElement(pointer); + + @override + bool create(Ref ref) { + final argument = this.argument as StreamPriority?; + return didCompleteSync(ref, argument); + } + + /// {@macro riverpod.override_with_value} + Override overrideWithValue(bool value) { + return $ProviderOverride( + origin: this, + providerOverride: $SyncValueProvider(value), + ); + } + + @override + bool operator ==(Object other) { + return other is DidCompleteSyncProvider && other.argument == argument; + } + + @override + int get hashCode { + return argument.hashCode; + } +} + +String _$didCompleteSyncHash() => r'1b954d75f05194156411ecc9860788ba9b13c2c8'; + +final class DidCompleteSyncFamily extends $Family + with $FunctionalFamilyOverride { + const DidCompleteSyncFamily._() + : super( + retry: null, + name: r'didCompleteSyncProvider', + dependencies: null, + $allTransitiveDependencies: null, + isAutoDispose: true, + ); + + DidCompleteSyncProvider call([StreamPriority? priority]) => + DidCompleteSyncProvider._(argument: priority, from: this); + + @override + String toString() => r'didCompleteSyncProvider'; +} diff --git a/lib/database/weight/database.dart b/lib/database/weight/database.dart new file mode 100644 index 000000000..d7f0212b0 --- /dev/null +++ b/lib/database/weight/database.dart @@ -0,0 +1,13 @@ +import 'package:drift/drift.dart'; +import 'package:powersync/powersync.dart' show uuid; +import 'package:wger/models/body_weight/weight_entry.dart'; + +@UseRowClass(WeightEntry) +class WeightEntryTable extends Table { + @override + String get tableName => 'weight_weightentry'; + + TextColumn get id => text().clientDefault(() => uuid.v4())(); + RealColumn get weight => real()(); + DateTimeColumn get date => dateTime().nullable()(); +} diff --git a/lib/models/body_weight/weight_entry.dart b/lib/models/body_weight/weight_entry.dart index 4e691da7f..0fa944df9 100644 --- a/lib/models/body_weight/weight_entry.dart +++ b/lib/models/body_weight/weight_entry.dart @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import 'package:drift/drift.dart' as drift; import 'package:json_annotation/json_annotation.dart'; import 'package:powersync/sqlite3.dart' as sqlite; import 'package:wger/helpers/json.dart'; @@ -55,6 +56,34 @@ class WeightEntry { date: date ?? this.date, ); + factory WeightEntry.fromData( + Map data, + drift.GeneratedDatabase db, { + String? prefix, + }) { + final effectivePrefix = prefix ?? ''; + + final rawId = data['${effectivePrefix}id']; + final rawWeight = data['${effectivePrefix}weight']; + final rawDate = data['${effectivePrefix}date']; + + final parsedId = rawId as String?; + final parsedWeight = rawWeight is num + ? rawWeight + : (rawWeight == null ? 0 : num.tryParse(rawWeight.toString()) ?? 0); + final parsedDate = rawDate is DateTime + ? rawDate + : (rawDate == null + ? DateTime.now() + : DateTime.tryParse(rawDate.toString()) ?? DateTime.now()); + + return WeightEntry( + id: parsedId, + weight: parsedWeight, + date: parsedDate, + ); + } + // Boilerplate factory WeightEntry.fromJson(Map json) => _$WeightEntryFromJson(json); diff --git a/lib/powersync.dart b/lib/powersync.dart index 6bab507fc..1813f27ed 100644 --- a/lib/powersync.dart +++ b/lib/powersync.dart @@ -3,87 +3,11 @@ import 'package:logging/logging.dart'; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; import 'package:powersync/powersync.dart'; -import 'package:wger/api_client.dart'; -import 'package:wger/models/powersync/schema.dart'; +import 'package:wger/powersync/connector.dart'; +import 'package:wger/powersync/schema.dart'; final logger = Logger('powersync-django'); -/// Postgres Response codes that we cannot recover from by retrying. -final List fatalResponseCodes = [ - // Class 22 — Data Exception - // Examples include data type mismatch. - RegExp(r'^22...$'), - // Class 23 — Integrity Constraint Violation. - // Examples include NOT NULL, FOREIGN KEY and UNIQUE violations. - RegExp(r'^23...$'), - // INSUFFICIENT PRIVILEGE - typically a row-level security violation - RegExp(r'^42501$'), -]; - -class DjangoConnector extends PowerSyncBackendConnector { - PowerSyncDatabase db; - String baseUrl; - String powersyncUrl; - late ApiClient apiClient; - - DjangoConnector(this.db, this.baseUrl, this.powersyncUrl) { - apiClient = ApiClient(baseUrl); - } - - /// Get a token to authenticate against the PowerSync instance. - @override - Future fetchCredentials() async { - // Somewhat contrived to illustrate usage, see auth docs here: - // https://docs.powersync.com/usage/installation/authentication-setup/custom - // final wgerSession = await apiClient.getWgerJWTToken(); - final session = await apiClient.getPowersyncToken(); - // note: we don't set userId and expires property here. not sure if needed - logger.info('Powersync Url: $powersyncUrl'); - return PowerSyncCredentials(endpoint: powersyncUrl, token: session['token']); - } - - // Upload pending changes to Postgres via Django backend - // this is generic. on the django side we inspect the request and do model-specific operations - // would it make sense to do api calls here specific to the relevant model? (e.g. put to a todo-specific endpoint) - @override - Future uploadData(PowerSyncDatabase database) async { - final transaction = await database.getNextCrudTransaction(); - - if (transaction == null) { - return; - } - - try { - for (final op in transaction.crud) { - final record = { - 'table': op.table, - 'data': {'id': op.id, ...?op.opData}, - }; - - logger.fine('DIETER Uploading record', record); - - switch (op.op) { - case UpdateType.put: - await apiClient.upsert(record); - break; - case UpdateType.patch: - await apiClient.update(record); - break; - case UpdateType.delete: - await apiClient.delete(record); - break; - } - } - await transaction.complete(); - } on Exception catch (e) { - logger.severe('Error uploading data', e); - // Error may be retryable - e.g. network error or temporary server error. - // Throwing an error here causes this call to be retried after a delay. - rethrow; - } - } -} - /// Global reference to the database late final PowerSyncDatabase db; @@ -108,7 +32,7 @@ Future openDatabase(bool connect, String baseUrl, String powersyncUrl) asy // If the user is already logged in, connect immediately. // Otherwise, connect once logged in. - final currentConnector = DjangoConnector(db, baseUrl, powersyncUrl); + final currentConnector = DjangoConnector(baseUrl: baseUrl, powersyncUrl: powersyncUrl); db.connect(connector: currentConnector); // TODO: should we respond to login state changing? like here: diff --git a/lib/api_client.dart b/lib/powersync/api_client.dart similarity index 76% rename from lib/api_client.dart rename to lib/powersync/api_client.dart index 3f2371e56..ed74917f3 100644 --- a/lib/api_client.dart +++ b/lib/powersync/api_client.dart @@ -5,15 +5,24 @@ import 'package:http/http.dart' as http; import 'package:logging/logging.dart'; import 'package:wger/helpers/shared_preferences.dart'; -import 'helpers/consts.dart'; +import '../helpers/consts.dart'; class ApiClient { final _logger = Logger('powersync-ApiClient'); + late final uri = Uri.parse('$baseUrl/api/v2/upload-powersync-data'); final String baseUrl; + String token = ''; ApiClient(this.baseUrl); + Map getHeaders() { + return { + HttpHeaders.contentTypeHeader: 'application/json', + HttpHeaders.authorizationHeader: 'Token $token', + }; + } + /// Returns a powersync JWT token token /// /// Note that at the moment we use the permanent API token for authentication @@ -24,6 +33,7 @@ class ApiClient { final apiData = json.decode((await prefs.getString(PREFS_USER))!); _logger.info('posting our token "${apiData["token"]}" to $baseUrl/api/v2/powersync-token'); + token = apiData['token']; final response = await http.get( Uri.parse('$baseUrl/api/v2/powersync-token'), headers: { @@ -34,31 +44,33 @@ class ApiClient { _logger.info('response: status ${response.statusCode}, body ${response.body}'); if (response.statusCode == 200) { _logger.log(Level.ALL, response.body); - return json.decode(response.body); + final result = json.decode(response.body); + + return result; } throw Exception('Failed to fetch token'); } Future upsert(Map record) async { await http.put( - Uri.parse('$baseUrl/api/upload-powersync-data'), - headers: {'Content-Type': 'application/json'}, + uri, + headers: getHeaders(), body: json.encode(record), ); } Future update(Map record) async { await http.patch( - Uri.parse('$baseUrl/api/upload-powersync-data'), - headers: {'Content-Type': 'application/json'}, + uri, + headers: getHeaders(), body: json.encode(record), ); } Future delete(Map record) async { await http.delete( - Uri.parse('$baseUrl/api/v2/upload-powersync-data'), - headers: {'Content-Type': 'application/json'}, + uri, + headers: getHeaders(), body: json.encode(record), ); } diff --git a/lib/powersync/connector.dart b/lib/powersync/connector.dart new file mode 100644 index 000000000..53d4de09b --- /dev/null +++ b/lib/powersync/connector.dart @@ -0,0 +1,90 @@ +// This file performs setup of the PowerSync database +import 'package:logging/logging.dart'; +import 'package:powersync/powersync.dart'; +import 'package:wger/powersync/api_client.dart'; + +final logger = Logger('powersync-django'); + +/// Postgres Response codes that we cannot recover from by retrying. +final List fatalResponseCodes = [ + // Class 22 — Data Exception + // Examples include data type mismatch. + RegExp(r'^22...$'), + // Class 23 — Integrity Constraint Violation. + // Examples include NOT NULL, FOREIGN KEY and UNIQUE violations. + RegExp(r'^23...$'), + // INSUFFICIENT PRIVILEGE - typically a row-level security violation + RegExp(r'^42501$'), +]; + +class DjangoConnector extends PowerSyncBackendConnector { + late String baseUrl; + late String powersyncUrl; + late ApiClient apiClient; + + DjangoConnector({String? baseUrl, String? powersyncUrl}) { + this.baseUrl = baseUrl ?? 'http://localhost:8000'; + this.powersyncUrl = powersyncUrl ?? 'http://localhost:8080'; + + apiClient = ApiClient(this.baseUrl); + } + + /// Get a token to authenticate against the PowerSync instance. + @override + Future fetchCredentials() async { + // Somewhat contrived to illustrate usage, see auth docs here: + // https://docs.powersync.com/usage/installation/authentication-setup/custom + // final wgerSession = await apiClient.getWgerJWTToken(); + final session = await apiClient.getPowersyncToken(); + // note: we don't set userId and expires property here. not sure if needed + logger.info('Powersync Url: $powersyncUrl'); + return PowerSyncCredentials( + endpoint: powersyncUrl, + token: session['token'], + ); + } + + // Upload pending changes to Postgres via Django backend + // this is generic. on the django side we inspect the request and do model-specific operations + // would it make sense to do api calls here specific to the relevant model? (e.g. put to a todo-specific endpoint) + @override + Future uploadData(PowerSyncDatabase database) async { + final transaction = await database.getNextCrudTransaction(); + + if (transaction == null) { + return; + } + + try { + for (final op in transaction.crud) { + final record = { + 'table': op.table, + 'data': {'id': op.id, ...?op.opData}, + }; + + logger.fine('Uploading record', record); + + switch (op.op) { + case UpdateType.put: + logger.fine('Upserting record', record); + await apiClient.upsert(record); + break; + case UpdateType.patch: + logger.fine('Patching record', record); + await apiClient.update(record); + break; + case UpdateType.delete: + logger.fine('Deleting record', record); + await apiClient.delete(record); + break; + } + } + await transaction.complete(); + } on Exception catch (e) { + logger.severe('Error uploading data', e); + // Error may be retryable - e.g. network error or temporary server error. + // Throwing an error here causes this call to be retried after a delay. + rethrow; + } + } +} diff --git a/lib/models/powersync/schema.dart b/lib/powersync/schema.dart similarity index 64% rename from lib/models/powersync/schema.dart rename to lib/powersync/schema.dart index 9a71876e5..410dc18e1 100644 --- a/lib/models/powersync/schema.dart +++ b/lib/powersync/schema.dart @@ -1,11 +1,11 @@ import 'package:powersync/powersync.dart'; -const tableMuscles = 'exercises_muscle'; -const tableBodyWeights = 'weight_weightentry'; +const tableMuscle = 'exercises_muscle'; +const tableBodyWeight = 'weight_weightentry'; Schema schema = const Schema([ Table( - tableMuscles, + tableMuscle, [ Column.text('name'), Column.text('name_en'), @@ -13,8 +13,9 @@ Schema schema = const Schema([ ], ), Table( - tableBodyWeights, + tableBodyWeight, [ + Column.text('uuid'), Column.real('weight'), Column.text('date'), ], diff --git a/lib/providers/body_weight.dart b/lib/providers/body_weight.dart deleted file mode 100644 index 3d3b85b8f..000000000 --- a/lib/providers/body_weight.dart +++ /dev/null @@ -1,13 +0,0 @@ -// filepath: /Users/roland/Entwicklung/wger/flutter/lib/providers/body_weight.dart -// REMOVED: BodyWeightProvider -// -// This file was removed and replaced by the Riverpod implementation. -// A backup of the old ChangeNotifier implementation is available at: -// lib/providers/body_weight.deprecated.dart -// -// Please update any remaining imports to use the Riverpod providers: -// - lib/providers/body_weight_riverpod.dart -// - lib/providers/body_weight_state.dart -// - lib/providers/body_weight_repository.dart - -// Intentionally empty file to avoid accidental usage. diff --git a/lib/providers/body_weight_powersync.dart b/lib/providers/body_weight_powersync.dart index 57e50345f..47b04ef45 100644 --- a/lib/providers/body_weight_powersync.dart +++ b/lib/providers/body_weight_powersync.dart @@ -1,17 +1,42 @@ // Helper to read body weight entries from PowerSync local database and convert to WeightEntry +import 'package:drift/drift.dart'; import 'package:logging/logging.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; -import 'package:wger/models/powersync/schema.dart'; -import 'package:wger/powersync.dart' as ps; + +import '../database/powersync/database.dart'; + +part 'body_weight_powersync.g.dart'; final _log = Logger('body_weight_powersync'); -/// Watch the body weight entries as a stream. -Stream> watchBodyWeightEntries({ - Duration pollInterval = const Duration(seconds: 2), -}) { - return ps.db.watch('SELECT * FROM $tableBodyWeights ORDER BY id').map((results) { - return results.map(WeightEntry.fromRow).toList(growable: false); - }); +@riverpod +final class WeightEntryNotifier extends _$WeightEntryNotifier { + @override + Stream> build() { + final database = ref.watch(driftPowerSyncDatabase); + final query = database.select(database.weightEntryTable) + ..orderBy([(t) => OrderingTerm(expression: t.date)]); + return query.watch(); + } + + Future deleteEntry(String id) async { + final db = ref.read(driftPowerSyncDatabase); + + await (db.delete(db.weightEntryTable)..where((t) => t.id.equals(id))).go(); + } + + Future updateEntry(WeightEntry entry) async { + final db = ref.read(driftPowerSyncDatabase); + + final stmt = db.update(db.weightEntryTable)..where((t) => t.id.equals(entry.id!)); + + await stmt.write( + WeightEntryTableCompanion( + date: Value(entry.date), + weight: Value(entry.weight as double), + ), + ); + } } diff --git a/lib/providers/body_weight_powersync.g.dart b/lib/providers/body_weight_powersync.g.dart new file mode 100644 index 000000000..b8abbcba7 --- /dev/null +++ b/lib/providers/body_weight_powersync.g.dart @@ -0,0 +1,58 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'body_weight_powersync.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint, type=warning + +@ProviderFor(WeightEntryNotifier) +const weightEntryProvider = WeightEntryNotifierProvider._(); + +final class WeightEntryNotifierProvider + extends $StreamNotifierProvider> { + const WeightEntryNotifierProvider._() + : super( + from: null, + argument: null, + retry: null, + name: r'weightEntryProvider', + isAutoDispose: true, + dependencies: null, + $allTransitiveDependencies: null, + ); + + @override + String debugGetCreateSourceHash() => _$weightEntryNotifierHash(); + + @$internal + @override + WeightEntryNotifier create() => WeightEntryNotifier(); +} + +String _$weightEntryNotifierHash() => + r'e1ebd97614bf12e7fd64c4613a13b082cb01eb33'; + +abstract class _$WeightEntryNotifier + extends $StreamNotifier> { + Stream> build(); + @$mustCallSuper + @override + void runBuild() { + final created = build(); + final ref = + this.ref as $Ref>, List>; + final element = + ref.element + as $ClassProviderElement< + AnyNotifier>, List>, + AsyncValue>, + Object?, + Object? + >; + element.handleValue(ref, created); + } +} diff --git a/lib/providers/body_weight_repository.dart b/lib/providers/body_weight_repository.dart index 33c68a06b..d1831a7a7 100644 --- a/lib/providers/body_weight_repository.dart +++ b/lib/providers/body_weight_repository.dart @@ -2,35 +2,34 @@ * Repository for body weight network operations. */ -import 'package:http/http.dart'; import 'package:logging/logging.dart'; -import 'package:wger/helpers/consts.dart'; +import 'package:powersync/powersync.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; -import 'package:wger/providers/base_provider.dart'; +import 'package:wger/powersync.dart' as ps; +import 'package:wger/powersync/schema.dart'; class BodyWeightRepository { final _logger = Logger('BodyWeightRepository'); - final WgerBaseProvider baseProvider; static const BODY_WEIGHT_URL = 'weightentry'; - BodyWeightRepository(this.baseProvider); + BodyWeightRepository(); /// Fetches all weight entries (paginated on the server side) Future> fetchAll() async { _logger.info('Repository: fetching all body weight entries'); - final data = await baseProvider.fetchPaginated( - baseProvider.makeUrl( - BODY_WEIGHT_URL, - query: {'ordering': '-date', 'limit': API_MAX_PAGE_SIZE}, - ), - ); + // final data = await baseProvider.fetchPaginated( + // baseProvider.makeUrl( + // BODY_WEIGHT_URL, + // query: {'ordering': '-date', 'limit': API_MAX_PAGE_SIZE}, + // ), + // ); final out = []; - for (final entry in data) { - out.add(WeightEntry.fromJson(entry)); - } + // for (final entry in data) { + // out.add(WeightEntry.fromJson(entry)); + // } return out; } @@ -38,22 +37,45 @@ class BodyWeightRepository { /// Creates a new weight entry on the server and returns the created object Future create(WeightEntry entry) async { _logger.info('Repository: creating weight entry'); - final data = await baseProvider.post(entry.toJson(), baseProvider.makeUrl(BODY_WEIGHT_URL)); - return WeightEntry.fromJson(data); + final result = await ps.db.execute( + 'INSERT INTO $tableBodyWeight (id, weight, date) VALUES (?, ?, ?)', + [ + uuid.v4(), + entry.weight, + entry.date.toIso8601String(), + ], + ); + _logger.fine('result of insert: $result'); + + return WeightEntry(); + return WeightEntry.fromRow(result.first); } /// Updates an existing weight entry on the server - Future update(WeightEntry entry) async { + Future update(WeightEntry entry) async { _logger.info('Repository: updating weight entry ${entry.id}'); - await baseProvider.patch( - entry.toJson(), - baseProvider.makeUrl(BODY_WEIGHT_URL, id: int.parse(entry.id!)), + + final result = await ps.db.execute( + 'UPDATE $tableBodyWeight SET weight = ?, date = ? WHERE id = ?', + [ + entry.weight, + entry.date.toIso8601String(), + entry.id, + ], ); + + _logger.fine('result of update: $result'); + + return WeightEntry(); + return WeightEntry.fromRow(result.first); } /// Deletes a weight entry on the server - Future delete(String id) async { + Future delete(String id) async { _logger.info('Repository: deleting weight entry $id'); - return await baseProvider.deleteRequest(BODY_WEIGHT_URL, int.parse(id)); + await ps.db.execute( + 'DELETE FROM $tableBodyWeight WHERE id = ?', + [id], + ); } } diff --git a/lib/providers/body_weight_riverpod.dart b/lib/providers/body_weight_riverpod.dart index 8b5e80a73..c56ab31de 100644 --- a/lib/providers/body_weight_riverpod.dart +++ b/lib/providers/body_weight_riverpod.dart @@ -1,39 +1,16 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_riverpod/legacy.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; -import 'package:wger/providers/auth.dart'; -import 'package:wger/providers/body_weight_powersync.dart'; import 'package:wger/providers/body_weight_repository.dart'; import 'package:wger/providers/body_weight_state.dart'; -import 'package:wger/providers/wger_base_riverpod.dart'; -/// Provides a [BodyWeightRepository] for a given [AuthProvider]. -/// Usage: ref.watch(bodyWeightRepositoryProvider(authProvider)) -final bodyWeightRepositoryProvider = Provider.family( - (ref, auth) { - final base = ref.watch(wgerBaseProvider(auth)); - return BodyWeightRepository(base); - }, +final bodyWeightRepositoryProvider = Provider( + (ref) => BodyWeightRepository(), ); -/// StateNotifier provider for the list of [WeightEntry]s keyed by [AuthProvider]. -/// Usage: ref.watch(bodyWeightStateProvider(authProvider)) to get List -final bodyWeightStateProvider = - StateNotifierProvider.family, AuthProvider>( - (ref, auth) { - final repo = ref.watch(bodyWeightRepositoryProvider(auth)); - return BodyWeightState(repo); - }, - ); - -/// StreamProvider that exposes live updates from the local PowerSync DB for -/// body weight entries. Widgets can `ref.watch(bodyWeightStreamProvider(auth))` -/// to get an `AsyncValue>` that updates whenever PowerSync -/// reports changes. -final bodyWeightStreamProvider = StreamProvider.family, AuthProvider>( - (ref, auth) { - // The stream itself is independent of Auth for now; auth is kept as a - // family parameter for symmetry with other providers and potential - // future auth-dependent logic (e.g. different DB instances per user). - return watchBodyWeightEntries(); +final bodyWeightStateProvider = StateNotifierProvider>( + (ref) { + final repo = ref.watch(bodyWeightRepositoryProvider); + return BodyWeightState(repo); }, ); diff --git a/lib/providers/body_weight_state.dart b/lib/providers/body_weight_state.dart index 9dd774333..0ebd7a9c3 100644 --- a/lib/providers/body_weight_state.dart +++ b/lib/providers/body_weight_state.dart @@ -1,7 +1,7 @@ import 'dart:async'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:logging/logging.dart'; +import 'package:state_notifier/state_notifier.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; import 'package:wger/providers/body_weight_repository.dart'; @@ -49,16 +49,8 @@ class BodyWeightState extends StateNotifier> { return created; } - Future editEntry(WeightEntry entry) async { - await repository.update(entry); - // Update local copy if present - final idx = state.indexWhere((e) => e.id == entry.id); - if (idx >= 0) { - final newList = [...state]; - newList[idx] = entry; - newList.sort((a, b) => b.date.compareTo(a.date)); - state = newList; - } + Future editEntry(WeightEntry entry) async { + return repository.update(entry); } Future deleteEntry(String id) async { @@ -73,11 +65,11 @@ class BodyWeightState extends StateNotifier> { try { final response = await repository.delete(id); - if (response.statusCode >= 400) { - // Revert - state = [...state]..insert(idx, removed); - throw Exception('Failed to delete: ${response.statusCode}'); - } + // if (response.statusCode >= 400) { + // // Revert + // state = [...state]..insert(idx, removed); + // throw Exception('Failed to delete: ${response.statusCode}'); + // } } catch (e) { // Revert on any error and rethrow state = [...state]..insert(idx, removed); diff --git a/lib/providers/gym_state.dart b/lib/providers/gym_state.dart index 659cc5250..f4bd7ee82 100644 --- a/lib/providers/gym_state.dart +++ b/lib/providers/gym_state.dart @@ -6,10 +6,7 @@ import 'package:wger/models/exercises/exercise.dart'; const DEFAULT_DURATION = Duration(hours: 5); -final StateNotifierProvider gymStateProvider = - StateNotifierProvider((ref) { - return GymStateNotifier(); - }); +final gymStateProvider = NotifierProvider(GymNotifier.new); class GymState { final Map exercisePages; @@ -62,10 +59,11 @@ class GymState { } } -class GymStateNotifier extends StateNotifier { +class GymNotifier extends Notifier { final _logger = Logger('GymStateNotifier'); - GymStateNotifier() : super(GymState()); + @override + GymState build() => GymState(); void setCurrentPage(int page) { // _logger.fine('Setting page from ${state.currentPage} to $page'); diff --git a/lib/providers/plate_weights.dart b/lib/providers/plate_weights.dart index 55a6e20b4..09d136196 100644 --- a/lib/providers/plate_weights.dart +++ b/lib/providers/plate_weights.dart @@ -16,10 +16,9 @@ const DEFAULT_BAR_WEIGHT_LB = 45; const PREFS_KEY_PLATES = 'selectedPlates'; -final plateCalculatorProvider = - StateNotifierProvider((ref) { - return PlateCalculatorNotifier(); - }); +final plateCalculatorProvider = NotifierProvider( + PlateCalculatorNotifier.new, +); class PlateCalculatorState { final _logger = Logger('PlateWeightsState'); @@ -135,16 +134,19 @@ class PlateCalculatorState { } } -class PlateCalculatorNotifier extends StateNotifier { +class PlateCalculatorNotifier extends Notifier { final _logger = Logger('PlateCalculatorNotifier'); late SharedPreferencesAsync prefs; - PlateCalculatorNotifier({SharedPreferencesAsync? prefs}) : super(PlateCalculatorState()) { + PlateCalculatorNotifier({SharedPreferencesAsync? prefs}) : super() { this.prefs = prefs ?? PreferenceHelper.asyncPref; _readDataFromSharedPrefs(); } + @override + PlateCalculatorState build() => PlateCalculatorState(); + Future saveToSharedPrefs() async { _logger.fine('Saving plate data to SharedPreferences'); await prefs.setString(PREFS_KEY_PLATES, jsonEncode(state.toJson())); diff --git a/lib/screens/home_tabs_screen.dart b/lib/screens/home_tabs_screen.dart index 824b44442..feae4a4ae 100644 --- a/lib/screens/home_tabs_screen.dart +++ b/lib/screens/home_tabs_screen.dart @@ -23,7 +23,7 @@ import 'package:logging/logging.dart'; import 'package:provider/provider.dart'; import 'package:rive/rive.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; -import 'package:wger/powersync.dart'; +import 'package:wger/powersync/connector.dart'; import 'package:wger/providers/auth.dart'; import 'package:wger/providers/exercises.dart'; import 'package:wger/providers/gallery.dart'; @@ -76,15 +76,15 @@ class _HomeTabsScreenState extends riverpod.ConsumerState final baseUrl = authProvider.serverUrl!; final powerSyncUrl = baseUrl.replaceAll(':8000', ':8080'); - await openDatabase(false, baseUrl, powerSyncUrl); + // await openDatabase(false, baseUrl, powerSyncUrl); - final connector = DjangoConnector(db, baseUrl, powerSyncUrl); + final connector = DjangoConnector(baseUrl: baseUrl, powersyncUrl: powerSyncUrl); // try { // TODO: should we cache these credentials? that's what their demo does? // we could maybe get the initial token from the /api/v2/login call final credentials = await connector.fetchCredentials(); widget._logger.fine('fetched credentials: $credentials'); - await openDatabase(true, baseUrl, powerSyncUrl); + // await openDatabase(true, baseUrl, powerSyncUrl); // } catch (e) { // widget._logger.warning('failed to fetchCredentials: $e'); // }/ diff --git a/lib/widgets/core/app_bar.dart b/lib/widgets/core/app_bar.dart index 506d8a197..6a54405e9 100644 --- a/lib/widgets/core/app_bar.dart +++ b/lib/widgets/core/app_bar.dart @@ -96,7 +96,7 @@ class MainAppBar extends ConsumerWidget implements PreferredSizeWidget { auth.logout(); context.read().clear(); context.read().clear(); - ref.read(bodyWeightStateProvider(auth).notifier).clear(); + ref.read(bodyWeightStateProvider.notifier).clear(); context.read().clear(); context.read().clear(); diff --git a/lib/widgets/dashboard/calendar.dart b/lib/widgets/dashboard/calendar.dart index a657e4656..605865c56 100644 --- a/lib/widgets/dashboard/calendar.dart +++ b/lib/widgets/dashboard/calendar.dart @@ -25,7 +25,6 @@ import 'package:wger/helpers/consts.dart'; import 'package:wger/helpers/date.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; -import 'package:wger/providers/auth.dart'; import 'package:wger/providers/body_weight_riverpod.dart'; import 'package:wger/providers/measurement.dart'; import 'package:wger/providers/nutrition.dart'; @@ -103,8 +102,7 @@ class _DashboardCalendarWidgetState extends riverpod.ConsumerState(); - final entries = ref.read(bodyWeightStateProvider(auth)); + final entries = ref.read(bodyWeightStateProvider); for (final entry in entries) { final date = DateFormatLists.format(entry.date); diff --git a/lib/widgets/dashboard/widgets/weight.dart b/lib/widgets/dashboard/widgets/weight.dart index 4aad8b5e4..2d1c53ccf 100644 --- a/lib/widgets/dashboard/widgets/weight.dart +++ b/lib/widgets/dashboard/widgets/weight.dart @@ -21,7 +21,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; -import 'package:wger/providers/auth.dart'; import 'package:wger/providers/body_weight_riverpod.dart'; import 'package:wger/providers/user.dart'; import 'package:wger/screens/form_screen.dart'; @@ -37,8 +36,7 @@ class DashboardWeightWidget extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final profile = context.read().profile; - final auth = context.read(); - final entriesList = ref.watch(bodyWeightStateProvider(auth)); + final entriesList = ref.watch(bodyWeightStateProvider); final (entriesAll, entries7dAvg) = sensibleRange( entriesList.map((e) => MeasurementChartEntry(e.weight, e.date)).toList(), diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 965a8a304..4ef239eb2 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -39,7 +39,7 @@ class NutritionalPlanDetailWidget extends riverpod.ConsumerWidget { Widget build(BuildContext context, riverpod.WidgetRef ref) { final nutritionalGoals = _nutritionalPlan.nutritionalGoals; final auth = context.read(); - final entriesList = ref.watch(bodyWeightStateProvider(auth)); + final entriesList = ref.watch(bodyWeightStateProvider); final WeightEntry? lastWeightEntry = entriesList.isNotEmpty ? entriesList.first : null; final nutritionalGoalsGperKg = lastWeightEntry != null ? nutritionalGoals / lastWeightEntry.weight.toDouble() diff --git a/lib/widgets/nutrition/nutritional_plans_list.dart b/lib/widgets/nutrition/nutritional_plans_list.dart index 41d63051b..7c499d578 100644 --- a/lib/widgets/nutrition/nutritional_plans_list.dart +++ b/lib/widgets/nutrition/nutritional_plans_list.dart @@ -43,7 +43,7 @@ class NutritionalPlansList extends riverpod.ConsumerWidget { DateTime? endDate, ) { final auth = context.read(); - final entriesList = ref.watch(bodyWeightStateProvider(auth)); + final entriesList = ref.watch(bodyWeightStateProvider); final entriesAll = entriesList.map((e) => MeasurementChartEntry(e.weight, e.date)).toList(); final entries7dAvg = moving7dAverage(entriesAll).whereDateWithInterpolation(startDate, endDate); diff --git a/lib/widgets/weight/forms.dart b/lib/widgets/weight/forms.dart index 38c48a69e..9400e2593 100644 --- a/lib/widgets/weight/forms.dart +++ b/lib/widgets/weight/forms.dart @@ -20,11 +20,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart' as riverpod; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; -import 'package:provider/provider.dart'; import 'package:wger/helpers/consts.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; -import 'package:wger/providers/auth.dart'; import 'package:wger/providers/body_weight_riverpod.dart'; class WeightForm extends riverpod.ConsumerWidget { @@ -199,6 +197,7 @@ class WeightForm extends riverpod.ConsumerWidget { return null; }, ), + Text("ID: ${_weightEntry.id}"), ElevatedButton( key: const Key(SUBMIT_BUTTON_KEY_NAME), child: Text(AppLocalizations.of(context).save), @@ -211,8 +210,7 @@ class WeightForm extends riverpod.ConsumerWidget { _form.currentState!.save(); // Save the entry on the server - final auth = context.read(); - final notifier = ref.read(bodyWeightStateProvider(auth).notifier); + final notifier = ref.read(bodyWeightStateProvider.notifier); _weightEntry.id == null ? await notifier.addEntry(_weightEntry) : await notifier.editEntry(_weightEntry); diff --git a/lib/widgets/weight/weight_overview.dart b/lib/widgets/weight/weight_overview.dart index 8106e4263..7237d6185 100644 --- a/lib/widgets/weight/weight_overview.dart +++ b/lib/widgets/weight/weight_overview.dart @@ -21,7 +21,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart' as riverpod; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; -import 'package:wger/providers/auth.dart'; +import 'package:wger/providers/body_weight_powersync.dart'; import 'package:wger/providers/body_weight_riverpod.dart'; import 'package:wger/providers/nutrition.dart'; import 'package:wger/providers/user.dart'; @@ -39,11 +39,11 @@ class WeightOverview extends riverpod.ConsumerWidget { final numberFormat = NumberFormat.decimalPattern(Localizations.localeOf(context).toString()); final plans = context.read().items; - final auth = context.read(); - final entriesAsync = ref.watch(bodyWeightStreamProvider(auth)); + final entries = ref.watch(weightEntryProvider); + // final entriesAsync = ref.watch(bodyWeightStreamProvider); // Handle stream states (loading/error/data) and reuse the existing UI - return entriesAsync.when( + return entries.when( data: (entriesList) { final entriesAll = entriesList.map((e) => MeasurementChartEntry(e.weight, e.date)).toList(); final entries7dAvg = moving7dAverage(entriesAll); @@ -76,8 +76,7 @@ class WeightOverview extends riverpod.ConsumerWidget { SizedBox( height: 300, child: RefreshIndicator( - onRefresh: () => - ref.read(bodyWeightStateProvider(auth).notifier).fetchAndSetEntries(), + onRefresh: () => ref.read(bodyWeightStateProvider.notifier).fetchAndSetEntries(), child: ListView.builder( padding: const EdgeInsets.all(10.0), itemCount: entriesList.length, @@ -112,7 +111,7 @@ class WeightOverview extends riverpod.ConsumerWidget { onTap: () async { // Delete entry from DB await ref - .read(bodyWeightStateProvider(auth).notifier) + .read(bodyWeightStateProvider.notifier) .deleteEntry(currentEntry.id!); // and inform the user diff --git a/pubspec.lock b/pubspec.lock index bf5065bb5..22fb3253c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,34 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: f0bb5d1648339c8308cc0b9838d8456b3cfe5c91f9dc1a735b4d003269e5da9a + sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f url: "https://pub.dev" source: hosted - version: "88.0.0" + version: "85.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "0b7b9c329d2879f8f05d6c05b32ee9ec025f39b077864bdb5ac9a7b63418a98f" + sha256: f4ad0fea5f102201015c9aae9d93bc02f75dd9491529a8c21f88d17a8523d44c url: "https://pub.dev" source: hosted - version: "8.1.1" + version: "7.6.0" + analyzer_buffer: + dependency: transitive + description: + name: analyzer_buffer + sha256: f7833bee67c03c37241c67f8741b17cc501b69d9758df7a5a4a13ed6c947be43 + url: "https://pub.dev" + source: hosted + version: "0.1.10" + analyzer_plugin: + dependency: transitive + description: + name: analyzer_plugin + sha256: a5ab7590c27b779f3d4de67f31c4109dbe13dd7339f86461a6f2a8ab2594d8ce + url: "https://pub.dev" + source: hosted + version: "0.13.4" archive: dependency: transitive description: @@ -53,10 +69,10 @@ packages: dependency: transitive description: name: build - sha256: "5b887c55a0f734b433b3b2d89f9cd1f99eb636b17e268a5b4259258bc916504b" + sha256: ce76b1d48875e3233fde17717c23d1f60a91cc631597e49a400c89b475395b1d url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "3.1.0" build_config: dependency: transitive description: @@ -73,14 +89,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.4" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: d1d57f7807debd7349b4726a19fd32ec8bc177c71ad0febf91a20f84cd2d4b46 + url: "https://pub.dev" + source: hosted + version: "3.0.3" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "4e54dbeefdc70691ba80b3bce3976af63b5425c8c07dface348dfee664a0edc1" + sha256: b24597fceb695969d47025c958f3837f9f0122e237c6a22cb082a5ac66c3ca30 url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.7.1" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "066dda7f73d8eb48ba630a55acb50c4a84a2e6b453b1cb4567f581729e794f7b" + url: "https://pub.dev" + source: hosted + version: "9.3.1" built_collection: dependency: transitive description: @@ -185,6 +217,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.8" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" cli_util: dependency: transitive description: @@ -225,6 +265,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" + url: "https://pub.dev" + source: hosted + version: "1.15.0" cross_file: dependency: transitive description: @@ -257,30 +305,54 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" + custom_lint_core: + dependency: transitive + description: + name: custom_lint_core + sha256: cc4684d22ca05bf0a4a51127e19a8aea576b42079ed2bc9e956f11aaebe35dd1 + url: "https://pub.dev" + source: hosted + version: "0.8.0" + custom_lint_visitor: + dependency: transitive + description: + name: custom_lint_visitor + sha256: "4a86a0d8415a91fbb8298d6ef03e9034dc8e323a599ddc4120a0e36c433983a2" + url: "https://pub.dev" + source: hosted + version: "1.0.0+7.7.0" dart_style: dependency: transitive description: name: dart_style - sha256: c87dfe3d56f183ffe9106a18aebc6db431fc7c98c31a54b952a77f3d54a85697 + sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" drift: dependency: "direct main" description: name: drift - sha256: "540cf382a3bfa99b76e51514db5b0ebcd81ce3679b7c1c9cb9478ff3735e47a1" + sha256: "83290a32ae006a7535c5ecf300722cb77177250d9df4ee2becc5fa8a36095114" url: "https://pub.dev" source: hosted - version: "2.28.2" + version: "2.29.0" drift_dev: dependency: "direct dev" description: name: drift_dev - sha256: "4db0eeedc7e8bed117a9f22d867ab7a3a294300fed5c269aac90d0b3545967ca" + sha256: "6019f827544e77524ffd5134ae0cb75dfd92ef5ef3e269872af92840c929cd43" url: "https://pub.dev" source: hosted - version: "2.28.3" + version: "2.29.0" + drift_sqlite_async: + dependency: "direct main" + description: + name: drift_sqlite_async + sha256: c61d9b1d9ac60dff802523faf8ae243567fc78b1713adac2204e75aaaba6ff24 + url: "https://pub.dev" + source: hosted + version: "0.2.5" equatable: dependency: "direct main" description: @@ -468,10 +540,10 @@ packages: dependency: "direct main" description: name: flutter_riverpod - sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" + sha256: "9e2d6907f12cc7d23a846847615941bddee8709bf2bfd274acdf5e80bcf22fde" url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "3.0.3" flutter_staggered_grid_view: dependency: "direct main" description: @@ -546,6 +618,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" fuchsia_remote_debug_protocol: dependency: transitive description: flutter @@ -700,6 +780,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" + js: + dependency: transitive + description: + name: js + sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" + url: "https://pub.dev" + source: hosted + version: "0.7.2" json_annotation: dependency: "direct main" description: @@ -816,10 +904,10 @@ packages: dependency: "direct dev" description: name: mockito - sha256: "4feb43bc4eb6c03e832f5fcd637d1abb44b98f9cfa245c58e27382f58859f8f6" + sha256: "2314cbe9165bcd16106513df9cf3c3224713087f09723b128928dc11a4379f99" url: "https://pub.dev" source: hosted - version: "5.5.1" + version: "5.5.0" multi_select_flutter: dependency: "direct main" description: @@ -852,6 +940,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" package_config: dependency: transitive description: @@ -1104,10 +1200,34 @@ packages: dependency: transitive description: name: riverpod - sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" + sha256: c406de02bff19d920b832bddfb8283548bfa05ce41c59afba57ce643e116aa59 url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "3.0.3" + riverpod_analyzer_utils: + dependency: transitive + description: + name: riverpod_analyzer_utils + sha256: a0f68adb078b790faa3c655110a017f9a7b7b079a57bbd40f540e80dce5fcd29 + url: "https://pub.dev" + source: hosted + version: "1.0.0-dev.7" + riverpod_annotation: + dependency: "direct main" + description: + name: riverpod_annotation + sha256: "7230014155777fc31ba3351bc2cb5a3b5717b11bfafe52b1553cb47d385f8897" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + riverpod_generator: + dependency: "direct dev" + description: + name: riverpod_generator + sha256: "49894543a42cf7a9954fc4e7366b6d3cb2e6ec0fa07775f660afcdd92d097702" + url: "https://pub.dev" + source: hosted + version: "3.0.3" shared_preferences: dependency: "direct main" description: @@ -1172,6 +1292,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" shelf_web_socket: dependency: transitive description: @@ -1197,10 +1333,10 @@ packages: dependency: transitive description: name: source_gen - sha256: ccf30b0c9fbcd79d8b6f5bfac23199fb354938436f62475e14aea0f29ee0f800 + sha256: "7b19d6ba131c6eb98bfcbf8d56c1a7002eba438af2e7ae6f8398b2b0f4f381e3" url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "3.1.0" source_helper: dependency: transitive description: @@ -1209,6 +1345,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.8" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" source_span: dependency: transitive description: @@ -1261,10 +1413,10 @@ packages: dependency: transitive description: name: sqlparser - sha256: "57090342af1ce32bb499aa641f4ecdd2d6231b9403cea537ac059e803cc20d67" + sha256: "54eea43e36dd3769274c3108625f9ea1a382f8d2ac8b16f3e4589d9bd9b0e16c" url: "https://pub.dev" source: hosted - version: "0.41.2" + version: "0.42.0" stack_trace: dependency: transitive description: @@ -1274,7 +1426,7 @@ packages: source: hosted version: "1.12.1" state_notifier: - dependency: transitive + dependency: "direct main" description: name: state_notifier sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb @@ -1290,7 +1442,7 @@ packages: source: hosted version: "2.1.4" stream_transform: - dependency: transitive + dependency: "direct main" description: name: stream_transform sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 @@ -1329,6 +1481,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.2" + test: + dependency: transitive + description: + name: test + sha256: "65e29d831719be0591f7b3b1a32a3cda258ec98c58c7b25f7b84241bc31215bb" + url: "https://pub.dev" + source: hosted + version: "1.26.2" test_api: dependency: transitive description: @@ -1337,6 +1497,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.6" + test_core: + dependency: transitive + description: + name: test_core + sha256: "80bf5a02b60af04b09e14f6fe68b921aad119493e26e490deaca5993fef1b05a" + url: "https://pub.dev" + source: hosted + version: "0.6.11" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" typed_data: dependency: transitive description: @@ -1553,6 +1729,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f787df300..f889f626b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -67,27 +67,35 @@ dependencies: version: ^3.0.2 video_player: ^2.10.0 logging: ^1.3.0 - flutter_riverpod: ^2.6.1 + flutter_riverpod: ^3.0.3 powersync: ^1.16.1 + drift_sqlite_async: ^0.2.5 + riverpod_annotation: ^3.0.3 + stream_transform: ^2.1.1 + state_notifier: ^1.0.0 dev_dependencies: flutter_test: sdk: flutter integration_test: sdk: flutter - build_runner: ^2.9.0 + build_runner: ^2.7.1 cider: ^0.2.7 - drift_dev: ^2.28.3 + drift_dev: ^2.29.0 flutter_lints: ^6.0.0 freezed: ^3.2.0 json_serializable: ^6.11.1 - mockito: ^5.5.1 + mockito: ^5.4.4 network_image_mock: ^2.1.1 shared_preferences_platform_interface: ^2.0.0 + riverpod_generator: ^3.0.3 # Script to read out unused translations #translations_cleaner: ^0.0.5 +#dependency_overrides: +# riverpod_generator: ^2.6.1 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/test/auth/auth_screen_test.mocks.dart b/test/auth/auth_screen_test.mocks.dart index 9d1250f38..a002f051b 100644 --- a/test/auth/auth_screen_test.mocks.dart +++ b/test/auth/auth_screen_test.mocks.dart @@ -24,13 +24,14 @@ import 'package:mockito/src/dummies.dart' as _i5; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response { - _FakeResponse_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedResponse { +class _FakeStreamedResponse_1 extends _i1.SmartFake + implements _i2.StreamedResponse { _FakeStreamedResponse_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } diff --git a/test/core/settings_test.mocks.dart b/test/core/settings_test.mocks.dart index ef86163dc..d398ea2fd 100644 --- a/test/core/settings_test.mocks.dart +++ b/test/core/settings_test.mocks.dart @@ -41,62 +41,74 @@ import 'package:wger/providers/user.dart' as _i21; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeExerciseDatabase_1 extends _i1.SmartFake implements _i3.ExerciseDatabase { +class _FakeExerciseDatabase_1 extends _i1.SmartFake + implements _i3.ExerciseDatabase { _FakeExerciseDatabase_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeExercise_2 extends _i1.SmartFake implements _i4.Exercise { - _FakeExercise_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeExerciseCategory_3 extends _i1.SmartFake implements _i5.ExerciseCategory { +class _FakeExerciseCategory_3 extends _i1.SmartFake + implements _i5.ExerciseCategory { _FakeExerciseCategory_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeEquipment_4 extends _i1.SmartFake implements _i6.Equipment { - _FakeEquipment_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMuscle_5 extends _i1.SmartFake implements _i7.Muscle { - _FakeMuscle_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeLanguage_6 extends _i1.SmartFake implements _i8.Language { - _FakeLanguage_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeIngredientDatabase_7 extends _i1.SmartFake implements _i9.IngredientDatabase { +class _FakeIngredientDatabase_7 extends _i1.SmartFake + implements _i9.IngredientDatabase { _FakeIngredientDatabase_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeNutritionalPlan_8 extends _i1.SmartFake implements _i10.NutritionalPlan { +class _FakeNutritionalPlan_8 extends _i1.SmartFake + implements _i10.NutritionalPlan { _FakeNutritionalPlan_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeMeal_9 extends _i1.SmartFake implements _i11.Meal { - _FakeMeal_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMeal_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMealItem_10 extends _i1.SmartFake implements _i12.MealItem { - _FakeMealItem_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMealItem_10(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeIngredient_11 extends _i1.SmartFake implements _i13.Ingredient { - _FakeIngredient_11(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeIngredient_11(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeSharedPreferencesAsync_12 extends _i1.SmartFake implements _i14.SharedPreferencesAsync { +class _FakeSharedPreferencesAsync_12 extends _i1.SmartFake + implements _i14.SharedPreferencesAsync { _FakeSharedPreferencesAsync_12(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -107,15 +119,18 @@ class _FakeAuthProvider_13 extends _i1.SmartFake implements _i15.AuthProvider { } class _FakeClient_14 extends _i1.SmartFake implements _i16.Client { - _FakeClient_14(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_14(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUri_15 extends _i1.SmartFake implements Uri { - _FakeUri_15(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_15(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeResponse_16 extends _i1.SmartFake implements _i16.Response { - _FakeResponse_16(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_16(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [ExercisesProvider]. @@ -205,22 +220,23 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { as List<_i8.Language>); @override - set database(_i3.ExerciseDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set exercises(List<_i4.Exercise>? value) => super.noSuchMethod( - Invocation.setter(#exercises, value), + set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter(#exercises, _exercises), returnValueForMissingStub: null, ); @override - set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); + set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => + super.noSuchMethod( + Invocation.setter(#filteredExercises, newFilteredExercises), + returnValueForMissingStub: null, + ); @override set languages(List<_i8.Language>? languages) => super.noSuchMethod( @@ -230,7 +246,8 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i18.Future setFilters(_i17.Filters? newFilters) => @@ -543,7 +560,8 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlansProvider { +class MockNutritionPlansProvider extends _i1.Mock + implements _i20.NutritionPlansProvider { MockNutritionPlansProvider() { _i1.throwOnMissingStub(this); } @@ -587,20 +605,21 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans as List<_i10.NutritionalPlan>); @override - set database(_i9.IngredientDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i9.IngredientDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set ingredients(List<_i13.Ingredient>? value) => super.noSuchMethod( - Invocation.setter(#ingredients, value), + set ingredients(List<_i13.Ingredient>? _ingredients) => super.noSuchMethod( + Invocation.setter(#ingredients, _ingredients), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( @@ -621,7 +640,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans @override _i11.Meal? findMealById(int? id) => - (super.noSuchMethod(Invocation.method(#findMealById, [id])) as _i11.Meal?); + (super.noSuchMethod(Invocation.method(#findMealById, [id])) + as _i11.Meal?); @override _i18.Future fetchAndSetAllPlansSparse() => @@ -928,26 +948,27 @@ class MockUserProvider extends _i1.Mock implements _i21.UserProvider { as _i14.SharedPreferencesAsync); @override - set themeMode(_i22.ThemeMode? value) => super.noSuchMethod( - Invocation.setter(#themeMode, value), + set themeMode(_i22.ThemeMode? _themeMode) => super.noSuchMethod( + Invocation.setter(#themeMode, _themeMode), returnValueForMissingStub: null, ); @override - set prefs(_i14.SharedPreferencesAsync? value) => super.noSuchMethod( - Invocation.setter(#prefs, value), + set prefs(_i14.SharedPreferencesAsync? _prefs) => super.noSuchMethod( + Invocation.setter(#prefs, _prefs), returnValueForMissingStub: null, ); @override - set profile(_i23.Profile? value) => super.noSuchMethod( - Invocation.setter(#profile, value), + set profile(_i23.Profile? _profile) => super.noSuchMethod( + Invocation.setter(#profile, _profile), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( @@ -1038,14 +1059,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { as _i16.Client); @override - set auth(_i15.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i15.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i16.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i16.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); @@ -1143,7 +1164,8 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { /// /// See the documentation for Mockito's code generation for more information. // ignore: must_be_immutable -class MockSharedPreferencesAsync extends _i1.Mock implements _i14.SharedPreferencesAsync { +class MockSharedPreferencesAsync extends _i1.Mock + implements _i14.SharedPreferencesAsync { MockSharedPreferencesAsync() { _i1.throwOnMissingStub(this); } diff --git a/test/core/validators_test.mocks.dart b/test/core/validators_test.mocks.dart index 5702e7443..c563dc56d 100644 --- a/test/core/validators_test.mocks.dart +++ b/test/core/validators_test.mocks.dart @@ -20,7 +20,6 @@ import 'package:wger/l10n/generated/app_localizations.dart' as _i2; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member /// A class which mocks [AppLocalizations]. /// diff --git a/test/exercises/contribute_exercise_image_test.mocks.dart b/test/exercises/contribute_exercise_image_test.mocks.dart index c3685ed3e..dc64f7767 100644 --- a/test/exercises/contribute_exercise_image_test.mocks.dart +++ b/test/exercises/contribute_exercise_image_test.mocks.dart @@ -8,11 +8,11 @@ import 'dart:ui' as _i15; import 'package:http/http.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i8; +import 'package:mockito/src/dummies.dart' as _i7; import 'package:wger/models/exercises/category.dart' as _i13; import 'package:wger/models/exercises/equipment.dart' as _i9; import 'package:wger/models/exercises/exercise_submission.dart' as _i11; -import 'package:wger/models/exercises/exercise_submission_images.dart' as _i7; +import 'package:wger/models/exercises/exercise_submission_images.dart' as _i8; import 'package:wger/models/exercises/language.dart' as _i12; import 'package:wger/models/exercises/muscle.dart' as _i10; import 'package:wger/models/exercises/variation.dart' as _i3; @@ -33,7 +33,6 @@ import 'package:wger/providers/base_provider.dart' as _i2; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) @@ -79,19 +78,11 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide ) as _i2.WgerBaseProvider); - @override - List<_i7.ExerciseSubmissionImage> get exerciseImages => - (super.noSuchMethod( - Invocation.getter(#exerciseImages), - returnValue: <_i7.ExerciseSubmissionImage>[], - ) - as List<_i7.ExerciseSubmissionImage>); - @override String get author => (super.noSuchMethod( Invocation.getter(#author), - returnValue: _i8.dummyValue( + returnValue: _i7.dummyValue( this, Invocation.getter(#author), ), @@ -114,6 +105,14 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide ) as List); + @override + List<_i8.ExerciseSubmissionImage> get exerciseImages => + (super.noSuchMethod( + Invocation.getter(#exerciseImages), + returnValue: <_i8.ExerciseSubmissionImage>[], + ) + as List<_i8.ExerciseSubmissionImage>); + @override List<_i9.Equipment> get equipment => (super.noSuchMethod( @@ -154,7 +153,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide _i11.ExerciseSubmissionApi get exerciseApiObject => (super.noSuchMethod( Invocation.getter(#exerciseApiObject), - returnValue: _i8.dummyValue<_i11.ExerciseSubmissionApi>( + returnValue: _i7.dummyValue<_i11.ExerciseSubmissionApi>( this, Invocation.getter(#exerciseApiObject), ), @@ -162,62 +161,62 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide as _i11.ExerciseSubmissionApi); @override - set author(String? value) => super.noSuchMethod( - Invocation.setter(#author, value), + set author(String? _author) => super.noSuchMethod( + Invocation.setter(#author, _author), returnValueForMissingStub: null, ); @override - set exerciseNameEn(String? value) => super.noSuchMethod( - Invocation.setter(#exerciseNameEn, value), + set exerciseNameEn(String? _exerciseNameEn) => super.noSuchMethod( + Invocation.setter(#exerciseNameEn, _exerciseNameEn), returnValueForMissingStub: null, ); @override - set exerciseNameTrans(String? value) => super.noSuchMethod( - Invocation.setter(#exerciseNameTrans, value), + set exerciseNameTrans(String? _exerciseNameTrans) => super.noSuchMethod( + Invocation.setter(#exerciseNameTrans, _exerciseNameTrans), returnValueForMissingStub: null, ); @override - set descriptionEn(String? value) => super.noSuchMethod( - Invocation.setter(#descriptionEn, value), + set descriptionEn(String? _descriptionEn) => super.noSuchMethod( + Invocation.setter(#descriptionEn, _descriptionEn), returnValueForMissingStub: null, ); @override - set descriptionTrans(String? value) => super.noSuchMethod( - Invocation.setter(#descriptionTrans, value), + set descriptionTrans(String? _descriptionTrans) => super.noSuchMethod( + Invocation.setter(#descriptionTrans, _descriptionTrans), returnValueForMissingStub: null, ); @override - set languageEn(_i12.Language? value) => super.noSuchMethod( - Invocation.setter(#languageEn, value), + set languageEn(_i12.Language? _languageEn) => super.noSuchMethod( + Invocation.setter(#languageEn, _languageEn), returnValueForMissingStub: null, ); @override - set languageTranslation(_i12.Language? value) => super.noSuchMethod( - Invocation.setter(#languageTranslation, value), + set languageTranslation(_i12.Language? _languageTranslation) => super.noSuchMethod( + Invocation.setter(#languageTranslation, _languageTranslation), returnValueForMissingStub: null, ); @override - set alternateNamesEn(List? value) => super.noSuchMethod( - Invocation.setter(#alternateNamesEn, value), + set alternateNamesEn(List? _alternateNamesEn) => super.noSuchMethod( + Invocation.setter(#alternateNamesEn, _alternateNamesEn), returnValueForMissingStub: null, ); @override - set alternateNamesTrans(List? value) => super.noSuchMethod( - Invocation.setter(#alternateNamesTrans, value), + set alternateNamesTrans(List? _alternateNamesTrans) => super.noSuchMethod( + Invocation.setter(#alternateNamesTrans, _alternateNamesTrans), returnValueForMissingStub: null, ); @override - set category(_i13.ExerciseCategory? value) => super.noSuchMethod( - Invocation.setter(#category, value), + set category(_i13.ExerciseCategory? _category) => super.noSuchMethod( + Invocation.setter(#category, _category), returnValueForMissingStub: null, ); @@ -262,7 +261,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i6.AddExerciseProvide ); @override - void addExerciseImages(List<_i7.ExerciseSubmissionImage>? images) => super.noSuchMethod( + void addExerciseImages(List<_i8.ExerciseSubmissionImage>? images) => super.noSuchMethod( Invocation.method(#addExerciseImages, [images]), returnValueForMissingStub: null, ); @@ -356,14 +355,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { as _i5.Client); @override - set auth(_i4.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i4.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i5.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i5.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/exercises/contribute_exercise_test.mocks.dart b/test/exercises/contribute_exercise_test.mocks.dart index 726b8a14f..012f064d2 100644 --- a/test/exercises/contribute_exercise_test.mocks.dart +++ b/test/exercises/contribute_exercise_test.mocks.dart @@ -8,14 +8,14 @@ import 'dart:ui' as _i16; import 'package:flutter/material.dart' as _i18; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i13; +import 'package:mockito/src/dummies.dart' as _i12; import 'package:shared_preferences/shared_preferences.dart' as _i4; import 'package:wger/database/exercises/exercise_database.dart' as _i5; import 'package:wger/models/exercises/category.dart' as _i7; import 'package:wger/models/exercises/equipment.dart' as _i8; import 'package:wger/models/exercises/exercise.dart' as _i6; import 'package:wger/models/exercises/exercise_submission.dart' as _i14; -import 'package:wger/models/exercises/exercise_submission_images.dart' as _i12; +import 'package:wger/models/exercises/exercise_submission_images.dart' as _i13; import 'package:wger/models/exercises/language.dart' as _i10; import 'package:wger/models/exercises/muscle.dart' as _i9; import 'package:wger/models/exercises/variation.dart' as _i3; @@ -38,52 +38,61 @@ import 'package:wger/providers/user.dart' as _i17; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeVariation_1 extends _i1.SmartFake implements _i3.Variation { - _FakeVariation_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeVariation_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeSharedPreferencesAsync_2 extends _i1.SmartFake implements _i4.SharedPreferencesAsync { +class _FakeSharedPreferencesAsync_2 extends _i1.SmartFake + implements _i4.SharedPreferencesAsync { _FakeSharedPreferencesAsync_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeExerciseDatabase_3 extends _i1.SmartFake implements _i5.ExerciseDatabase { +class _FakeExerciseDatabase_3 extends _i1.SmartFake + implements _i5.ExerciseDatabase { _FakeExerciseDatabase_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeExercise_4 extends _i1.SmartFake implements _i6.Exercise { - _FakeExercise_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeExerciseCategory_5 extends _i1.SmartFake implements _i7.ExerciseCategory { +class _FakeExerciseCategory_5 extends _i1.SmartFake + implements _i7.ExerciseCategory { _FakeExerciseCategory_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeEquipment_6 extends _i1.SmartFake implements _i8.Equipment { - _FakeEquipment_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMuscle_7 extends _i1.SmartFake implements _i9.Muscle { - _FakeMuscle_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeLanguage_8 extends _i1.SmartFake implements _i10.Language { - _FakeLanguage_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_8(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [AddExerciseProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvider { +class MockAddExerciseProvider extends _i1.Mock + implements _i11.AddExerciseProvider { MockAddExerciseProvider() { _i1.throwOnMissingStub(this); } @@ -99,19 +108,11 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid ) as _i2.WgerBaseProvider); - @override - List<_i12.ExerciseSubmissionImage> get exerciseImages => - (super.noSuchMethod( - Invocation.getter(#exerciseImages), - returnValue: <_i12.ExerciseSubmissionImage>[], - ) - as List<_i12.ExerciseSubmissionImage>); - @override String get author => (super.noSuchMethod( Invocation.getter(#author), - returnValue: _i13.dummyValue( + returnValue: _i12.dummyValue( this, Invocation.getter(#author), ), @@ -134,6 +135,14 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid ) as List); + @override + List<_i13.ExerciseSubmissionImage> get exerciseImages => + (super.noSuchMethod( + Invocation.getter(#exerciseImages), + returnValue: <_i13.ExerciseSubmissionImage>[], + ) + as List<_i13.ExerciseSubmissionImage>); + @override List<_i8.Equipment> get equipment => (super.noSuchMethod( @@ -144,7 +153,8 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid @override bool get newVariation => - (super.noSuchMethod(Invocation.getter(#newVariation), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#newVariation), returnValue: false) + as bool); @override _i3.Variation get variation => @@ -174,7 +184,7 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid _i14.ExerciseSubmissionApi get exerciseApiObject => (super.noSuchMethod( Invocation.getter(#exerciseApiObject), - returnValue: _i13.dummyValue<_i14.ExerciseSubmissionApi>( + returnValue: _i12.dummyValue<_i14.ExerciseSubmissionApi>( this, Invocation.getter(#exerciseApiObject), ), @@ -182,62 +192,64 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid as _i14.ExerciseSubmissionApi); @override - set author(String? value) => super.noSuchMethod( - Invocation.setter(#author, value), + set author(String? _author) => super.noSuchMethod( + Invocation.setter(#author, _author), returnValueForMissingStub: null, ); @override - set exerciseNameEn(String? value) => super.noSuchMethod( - Invocation.setter(#exerciseNameEn, value), + set exerciseNameEn(String? _exerciseNameEn) => super.noSuchMethod( + Invocation.setter(#exerciseNameEn, _exerciseNameEn), returnValueForMissingStub: null, ); @override - set exerciseNameTrans(String? value) => super.noSuchMethod( - Invocation.setter(#exerciseNameTrans, value), + set exerciseNameTrans(String? _exerciseNameTrans) => super.noSuchMethod( + Invocation.setter(#exerciseNameTrans, _exerciseNameTrans), returnValueForMissingStub: null, ); @override - set descriptionEn(String? value) => super.noSuchMethod( - Invocation.setter(#descriptionEn, value), + set descriptionEn(String? _descriptionEn) => super.noSuchMethod( + Invocation.setter(#descriptionEn, _descriptionEn), returnValueForMissingStub: null, ); @override - set descriptionTrans(String? value) => super.noSuchMethod( - Invocation.setter(#descriptionTrans, value), + set descriptionTrans(String? _descriptionTrans) => super.noSuchMethod( + Invocation.setter(#descriptionTrans, _descriptionTrans), returnValueForMissingStub: null, ); @override - set languageEn(_i10.Language? value) => super.noSuchMethod( - Invocation.setter(#languageEn, value), + set languageEn(_i10.Language? _languageEn) => super.noSuchMethod( + Invocation.setter(#languageEn, _languageEn), returnValueForMissingStub: null, ); @override - set languageTranslation(_i10.Language? value) => super.noSuchMethod( - Invocation.setter(#languageTranslation, value), + set languageTranslation(_i10.Language? _languageTranslation) => + super.noSuchMethod( + Invocation.setter(#languageTranslation, _languageTranslation), + returnValueForMissingStub: null, + ); + + @override + set alternateNamesEn(List? _alternateNamesEn) => super.noSuchMethod( + Invocation.setter(#alternateNamesEn, _alternateNamesEn), returnValueForMissingStub: null, ); @override - set alternateNamesEn(List? value) => super.noSuchMethod( - Invocation.setter(#alternateNamesEn, value), - returnValueForMissingStub: null, - ); + set alternateNamesTrans(List? _alternateNamesTrans) => + super.noSuchMethod( + Invocation.setter(#alternateNamesTrans, _alternateNamesTrans), + returnValueForMissingStub: null, + ); @override - set alternateNamesTrans(List? value) => super.noSuchMethod( - Invocation.setter(#alternateNamesTrans, value), - returnValueForMissingStub: null, - ); - - @override - set category(_i7.ExerciseCategory? value) => super.noSuchMethod( - Invocation.setter(#category, value), + set category(_i7.ExerciseCategory? _category) => super.noSuchMethod( + Invocation.setter(#category, _category), returnValueForMissingStub: null, ); @@ -273,7 +285,8 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( @@ -282,10 +295,11 @@ class MockAddExerciseProvider extends _i1.Mock implements _i11.AddExerciseProvid ); @override - void addExerciseImages(List<_i12.ExerciseSubmissionImage>? images) => super.noSuchMethod( - Invocation.method(#addExerciseImages, [images]), - returnValueForMissingStub: null, - ); + void addExerciseImages(List<_i13.ExerciseSubmissionImage>? images) => + super.noSuchMethod( + Invocation.method(#addExerciseImages, [images]), + returnValueForMissingStub: null, + ); @override void removeImage(String? path) => super.noSuchMethod( @@ -390,26 +404,27 @@ class MockUserProvider extends _i1.Mock implements _i17.UserProvider { as _i4.SharedPreferencesAsync); @override - set themeMode(_i18.ThemeMode? value) => super.noSuchMethod( - Invocation.setter(#themeMode, value), + set themeMode(_i18.ThemeMode? _themeMode) => super.noSuchMethod( + Invocation.setter(#themeMode, _themeMode), returnValueForMissingStub: null, ); @override - set prefs(_i4.SharedPreferencesAsync? value) => super.noSuchMethod( - Invocation.setter(#prefs, value), + set prefs(_i4.SharedPreferencesAsync? _prefs) => super.noSuchMethod( + Invocation.setter(#prefs, _prefs), returnValueForMissingStub: null, ); @override - set profile(_i19.Profile? value) => super.noSuchMethod( - Invocation.setter(#profile, value), + set profile(_i19.Profile? _profile) => super.noSuchMethod( + Invocation.setter(#profile, _profile), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( @@ -562,22 +577,23 @@ class MockExercisesProvider extends _i1.Mock implements _i20.ExercisesProvider { as List<_i10.Language>); @override - set database(_i5.ExerciseDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set exercises(List<_i6.Exercise>? value) => super.noSuchMethod( - Invocation.setter(#exercises, value), + set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter(#exercises, _exercises), returnValueForMissingStub: null, ); @override - set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); + set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => + super.noSuchMethod( + Invocation.setter(#filteredExercises, newFilteredExercises), + returnValueForMissingStub: null, + ); @override set languages(List<_i10.Language>? languages) => super.noSuchMethod( @@ -587,7 +603,8 @@ class MockExercisesProvider extends _i1.Mock implements _i20.ExercisesProvider { @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i15.Future setFilters(_i20.Filters? newFilters) => diff --git a/test/exercises/exercises_detail_widget_test.mocks.dart b/test/exercises/exercises_detail_widget_test.mocks.dart index 00197a343..b7d32696a 100644 --- a/test/exercises/exercises_detail_widget_test.mocks.dart +++ b/test/exercises/exercises_detail_widget_test.mocks.dart @@ -29,37 +29,43 @@ import 'package:wger/providers/exercises.dart' as _i9; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeExerciseDatabase_1 extends _i1.SmartFake implements _i3.ExerciseDatabase { +class _FakeExerciseDatabase_1 extends _i1.SmartFake + implements _i3.ExerciseDatabase { _FakeExerciseDatabase_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeExercise_2 extends _i1.SmartFake implements _i4.Exercise { - _FakeExercise_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeExerciseCategory_3 extends _i1.SmartFake implements _i5.ExerciseCategory { +class _FakeExerciseCategory_3 extends _i1.SmartFake + implements _i5.ExerciseCategory { _FakeExerciseCategory_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeEquipment_4 extends _i1.SmartFake implements _i6.Equipment { - _FakeEquipment_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMuscle_5 extends _i1.SmartFake implements _i7.Muscle { - _FakeMuscle_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeLanguage_6 extends _i1.SmartFake implements _i8.Language { - _FakeLanguage_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [ExercisesProvider]. @@ -149,22 +155,23 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider { as List<_i8.Language>); @override - set database(_i3.ExerciseDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set exercises(List<_i4.Exercise>? value) => super.noSuchMethod( - Invocation.setter(#exercises, value), + set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter(#exercises, _exercises), returnValueForMissingStub: null, ); @override - set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); + set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => + super.noSuchMethod( + Invocation.setter(#filteredExercises, newFilteredExercises), + returnValueForMissingStub: null, + ); @override set languages(List<_i8.Language>? languages) => super.noSuchMethod( @@ -174,7 +181,8 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider { @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i10.Future setFilters(_i9.Filters? newFilters) => diff --git a/test/gallery/gallery_form_test.mocks.dart b/test/gallery/gallery_form_test.mocks.dart index e14d78381..0fb08f36f 100644 --- a/test/gallery/gallery_form_test.mocks.dart +++ b/test/gallery/gallery_form_test.mocks.dart @@ -26,7 +26,6 @@ import 'package:wger/providers/gallery.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); @@ -61,8 +60,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { as List<_i5.Image>); @override - set images(List<_i5.Image>? value) => super.noSuchMethod( - Invocation.setter(#images, value), + set images(List<_i5.Image>? _images) => super.noSuchMethod( + Invocation.setter(#images, _images), returnValueForMissingStub: null, ); @@ -83,14 +82,14 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/gallery/gallery_screen_test.mocks.dart b/test/gallery/gallery_screen_test.mocks.dart index d1ab1318c..bab4add58 100644 --- a/test/gallery/gallery_screen_test.mocks.dart +++ b/test/gallery/gallery_screen_test.mocks.dart @@ -26,7 +26,6 @@ import 'package:wger/providers/gallery.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); @@ -61,8 +60,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { as List<_i5.Image>); @override - set images(List<_i5.Image>? value) => super.noSuchMethod( - Invocation.setter(#images, value), + set images(List<_i5.Image>? _images) => super.noSuchMethod( + Invocation.setter(#images, _images), returnValueForMissingStub: null, ); @@ -83,14 +82,14 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/measurements/measurement_categories_screen_test.mocks.dart b/test/measurements/measurement_categories_screen_test.mocks.dart index fdb563c23..a3b1db139 100644 --- a/test/measurements/measurement_categories_screen_test.mocks.dart +++ b/test/measurements/measurement_categories_screen_test.mocks.dart @@ -25,14 +25,15 @@ import 'package:wger/providers/measurement.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeMeasurementCategory_1 extends _i1.SmartFake implements _i3.MeasurementCategory { +class _FakeMeasurementCategory_1 extends _i1.SmartFake + implements _i3.MeasurementCategory { _FakeMeasurementCategory_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -40,7 +41,8 @@ class _FakeMeasurementCategory_1 extends _i1.SmartFake implements _i3.Measuremen /// A class which mocks [MeasurementProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvider { +class MockMeasurementProvider extends _i1.Mock + implements _i4.MeasurementProvider { MockMeasurementProvider() { _i1.throwOnMissingStub(this); } @@ -66,7 +68,8 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/measurements/measurement_provider_test.mocks.dart b/test/measurements/measurement_provider_test.mocks.dart index ef362a877..551cbf0e0 100644 --- a/test/measurements/measurement_provider_test.mocks.dart +++ b/test/measurements/measurement_provider_test.mocks.dart @@ -23,7 +23,6 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); @@ -66,14 +65,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/nutrition/nutritional_meal_form_test.mocks.dart b/test/nutrition/nutritional_meal_form_test.mocks.dart index bb2594896..3d955f618 100644 --- a/test/nutrition/nutritional_meal_form_test.mocks.dart +++ b/test/nutrition/nutritional_meal_form_test.mocks.dart @@ -28,39 +28,45 @@ import 'package:wger/providers/nutrition.dart' as _i8; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeIngredientDatabase_1 extends _i1.SmartFake implements _i3.IngredientDatabase { +class _FakeIngredientDatabase_1 extends _i1.SmartFake + implements _i3.IngredientDatabase { _FakeIngredientDatabase_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeNutritionalPlan_2 extends _i1.SmartFake implements _i4.NutritionalPlan { +class _FakeNutritionalPlan_2 extends _i1.SmartFake + implements _i4.NutritionalPlan { _FakeNutritionalPlan_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeMeal_3 extends _i1.SmartFake implements _i5.Meal { - _FakeMeal_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMeal_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMealItem_4 extends _i1.SmartFake implements _i6.MealItem { - _FakeMealItem_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMealItem_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeIngredient_5 extends _i1.SmartFake implements _i7.Ingredient { - _FakeIngredient_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeIngredient_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansProvider { +class MockNutritionPlansProvider extends _i1.Mock + implements _i8.NutritionPlansProvider { MockNutritionPlansProvider() { _i1.throwOnMissingStub(this); } @@ -104,20 +110,21 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP as List<_i4.NutritionalPlan>); @override - set database(_i3.IngredientDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i3.IngredientDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set ingredients(List<_i7.Ingredient>? value) => super.noSuchMethod( - Invocation.setter(#ingredients, value), + set ingredients(List<_i7.Ingredient>? _ingredients) => super.noSuchMethod( + Invocation.setter(#ingredients, _ingredients), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/nutrition/nutritional_plan_form_test.mocks.dart b/test/nutrition/nutritional_plan_form_test.mocks.dart index bd16cc98b..b2413e948 100644 --- a/test/nutrition/nutritional_plan_form_test.mocks.dart +++ b/test/nutrition/nutritional_plan_form_test.mocks.dart @@ -28,39 +28,45 @@ import 'package:wger/providers/nutrition.dart' as _i8; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeIngredientDatabase_1 extends _i1.SmartFake implements _i3.IngredientDatabase { +class _FakeIngredientDatabase_1 extends _i1.SmartFake + implements _i3.IngredientDatabase { _FakeIngredientDatabase_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeNutritionalPlan_2 extends _i1.SmartFake implements _i4.NutritionalPlan { +class _FakeNutritionalPlan_2 extends _i1.SmartFake + implements _i4.NutritionalPlan { _FakeNutritionalPlan_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeMeal_3 extends _i1.SmartFake implements _i5.Meal { - _FakeMeal_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMeal_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMealItem_4 extends _i1.SmartFake implements _i6.MealItem { - _FakeMealItem_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMealItem_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeIngredient_5 extends _i1.SmartFake implements _i7.Ingredient { - _FakeIngredient_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeIngredient_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansProvider { +class MockNutritionPlansProvider extends _i1.Mock + implements _i8.NutritionPlansProvider { MockNutritionPlansProvider() { _i1.throwOnMissingStub(this); } @@ -104,20 +110,21 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP as List<_i4.NutritionalPlan>); @override - set database(_i3.IngredientDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i3.IngredientDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set ingredients(List<_i7.Ingredient>? value) => super.noSuchMethod( - Invocation.setter(#ingredients, value), + set ingredients(List<_i7.Ingredient>? _ingredients) => super.noSuchMethod( + Invocation.setter(#ingredients, _ingredients), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/nutrition/nutritional_plan_screen_test.mocks.dart b/test/nutrition/nutritional_plan_screen_test.mocks.dart index 2fe3c4ac5..a4d7d927a 100644 --- a/test/nutrition/nutritional_plan_screen_test.mocks.dart +++ b/test/nutrition/nutritional_plan_screen_test.mocks.dart @@ -28,25 +28,29 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeStreamedResponse_4 extends _i1.SmartFake implements _i3.StreamedResponse { +class _FakeStreamedResponse_4 extends _i1.SmartFake + implements _i3.StreamedResponse { _FakeStreamedResponse_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -76,14 +80,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); @@ -208,62 +212,67 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { @override bool get dataInit => - (super.noSuchMethod(Invocation.getter(#dataInit), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#dataInit), returnValue: false) + as bool); @override - bool get isAuth => (super.noSuchMethod(Invocation.getter(#isAuth), returnValue: false) as bool); + bool get isAuth => + (super.noSuchMethod(Invocation.getter(#isAuth), returnValue: false) + as bool); @override - set token(String? value) => super.noSuchMethod( - Invocation.setter(#token, value), + set token(String? _token) => super.noSuchMethod( + Invocation.setter(#token, _token), returnValueForMissingStub: null, ); @override - set serverUrl(String? value) => super.noSuchMethod( - Invocation.setter(#serverUrl, value), + set serverUrl(String? _serverUrl) => super.noSuchMethod( + Invocation.setter(#serverUrl, _serverUrl), returnValueForMissingStub: null, ); @override - set serverVersion(String? value) => super.noSuchMethod( - Invocation.setter(#serverVersion, value), + set serverVersion(String? _serverVersion) => super.noSuchMethod( + Invocation.setter(#serverVersion, _serverVersion), returnValueForMissingStub: null, ); @override - set applicationVersion(_i6.PackageInfo? value) => super.noSuchMethod( - Invocation.setter(#applicationVersion, value), + set applicationVersion(_i6.PackageInfo? _applicationVersion) => + super.noSuchMethod( + Invocation.setter(#applicationVersion, _applicationVersion), + returnValueForMissingStub: null, + ); + + @override + set metadata(Map? _metadata) => super.noSuchMethod( + Invocation.setter(#metadata, _metadata), returnValueForMissingStub: null, ); @override - set metadata(Map? value) => super.noSuchMethod( - Invocation.setter(#metadata, value), + set state(_i2.AuthState? _state) => super.noSuchMethod( + Invocation.setter(#state, _state), returnValueForMissingStub: null, ); @override - set state(_i2.AuthState? value) => super.noSuchMethod( - Invocation.setter(#state, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), - returnValueForMissingStub: null, - ); - - @override - set dataInit(bool? value) => super.noSuchMethod( - Invocation.setter(#dataInit, value), + set dataInit(bool? _dataInit) => super.noSuchMethod( + Invocation.setter(#dataInit, _dataInit), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i5.Future setServerVersion() => diff --git a/test/nutrition/nutritional_plans_screen_test.mocks.dart b/test/nutrition/nutritional_plans_screen_test.mocks.dart index c702d4015..0eee86159 100644 --- a/test/nutrition/nutritional_plans_screen_test.mocks.dart +++ b/test/nutrition/nutritional_plans_screen_test.mocks.dart @@ -28,25 +28,29 @@ import 'package:wger/providers/base_provider.dart' as _i8; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeClient_0 extends _i1.SmartFake implements _i2.Client { - _FakeClient_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeAuthProvider_1 extends _i1.SmartFake implements _i3.AuthProvider { - _FakeAuthProvider_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeResponse_3 extends _i1.SmartFake implements _i2.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeStreamedResponse_4 extends _i1.SmartFake implements _i2.StreamedResponse { +class _FakeStreamedResponse_4 extends _i1.SmartFake + implements _i2.StreamedResponse { _FakeStreamedResponse_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -85,62 +89,67 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { @override bool get dataInit => - (super.noSuchMethod(Invocation.getter(#dataInit), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#dataInit), returnValue: false) + as bool); @override - bool get isAuth => (super.noSuchMethod(Invocation.getter(#isAuth), returnValue: false) as bool); + bool get isAuth => + (super.noSuchMethod(Invocation.getter(#isAuth), returnValue: false) + as bool); @override - set token(String? value) => super.noSuchMethod( - Invocation.setter(#token, value), + set token(String? _token) => super.noSuchMethod( + Invocation.setter(#token, _token), returnValueForMissingStub: null, ); @override - set serverUrl(String? value) => super.noSuchMethod( - Invocation.setter(#serverUrl, value), + set serverUrl(String? _serverUrl) => super.noSuchMethod( + Invocation.setter(#serverUrl, _serverUrl), returnValueForMissingStub: null, ); @override - set serverVersion(String? value) => super.noSuchMethod( - Invocation.setter(#serverVersion, value), + set serverVersion(String? _serverVersion) => super.noSuchMethod( + Invocation.setter(#serverVersion, _serverVersion), returnValueForMissingStub: null, ); @override - set applicationVersion(_i4.PackageInfo? value) => super.noSuchMethod( - Invocation.setter(#applicationVersion, value), + set applicationVersion(_i4.PackageInfo? _applicationVersion) => + super.noSuchMethod( + Invocation.setter(#applicationVersion, _applicationVersion), + returnValueForMissingStub: null, + ); + + @override + set metadata(Map? _metadata) => super.noSuchMethod( + Invocation.setter(#metadata, _metadata), returnValueForMissingStub: null, ); @override - set metadata(Map? value) => super.noSuchMethod( - Invocation.setter(#metadata, value), + set state(_i3.AuthState? _state) => super.noSuchMethod( + Invocation.setter(#state, _state), returnValueForMissingStub: null, ); @override - set state(_i3.AuthState? value) => super.noSuchMethod( - Invocation.setter(#state, value), + set client(_i2.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); @override - set client(_i2.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), - returnValueForMissingStub: null, - ); - - @override - set dataInit(bool? value) => super.noSuchMethod( - Invocation.setter(#dataInit, value), + set dataInit(bool? _dataInit) => super.noSuchMethod( + Invocation.setter(#dataInit, _dataInit), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i5.Future setServerVersion() => @@ -311,14 +320,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider { as _i2.Client); @override - set auth(_i3.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i3.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i2.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i2.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/other/base_provider_test.mocks.dart b/test/other/base_provider_test.mocks.dart index 8731349fd..11feb4a5e 100644 --- a/test/other/base_provider_test.mocks.dart +++ b/test/other/base_provider_test.mocks.dart @@ -24,13 +24,14 @@ import 'package:mockito/src/dummies.dart' as _i5; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response { - _FakeResponse_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedResponse { +class _FakeStreamedResponse_1 extends _i1.SmartFake + implements _i2.StreamedResponse { _FakeStreamedResponse_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } diff --git a/test/providers/plate_calculator_test.mocks.dart b/test/providers/plate_calculator_test.mocks.dart index 9b3fed8e4..bcba37ab3 100644 --- a/test/providers/plate_calculator_test.mocks.dart +++ b/test/providers/plate_calculator_test.mocks.dart @@ -21,7 +21,6 @@ import 'package:shared_preferences/src/shared_preferences_async.dart' as _i2; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member /// A class which mocks [SharedPreferencesAsync]. /// diff --git a/test/routine/day_form_test.mocks.dart b/test/routine/day_form_test.mocks.dart index 1bfb6f5a1..87245999e 100644 --- a/test/routine/day_form_test.mocks.dart +++ b/test/routine/day_form_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/forms/session_form_test.mocks.dart b/test/routine/forms/session_form_test.mocks.dart index 504147ea3..d7e318ddc 100644 --- a/test/routine/forms/session_form_test.mocks.dart +++ b/test/routine/forms/session_form_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/gym_mode_screen_test.mocks.dart b/test/routine/gym_mode_screen_test.mocks.dart index 400d7e1f9..ab46ba316 100644 --- a/test/routine/gym_mode_screen_test.mocks.dart +++ b/test/routine/gym_mode_screen_test.mocks.dart @@ -43,91 +43,110 @@ import 'package:wger/providers/routines.dart' as _i23; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider { +class _FakeWgerBaseProvider_4 extends _i1.SmartFake + implements _i4.WgerBaseProvider { _FakeWgerBaseProvider_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeExerciseDatabase_5 extends _i1.SmartFake implements _i5.ExerciseDatabase { +class _FakeExerciseDatabase_5 extends _i1.SmartFake + implements _i5.ExerciseDatabase { _FakeExerciseDatabase_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeExercise_6 extends _i1.SmartFake implements _i6.Exercise { - _FakeExercise_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeExerciseCategory_7 extends _i1.SmartFake implements _i7.ExerciseCategory { +class _FakeExerciseCategory_7 extends _i1.SmartFake + implements _i7.ExerciseCategory { _FakeExerciseCategory_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeEquipment_8 extends _i1.SmartFake implements _i8.Equipment { - _FakeEquipment_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_8(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMuscle_9 extends _i1.SmartFake implements _i9.Muscle { - _FakeMuscle_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeLanguage_10 extends _i1.SmartFake implements _i10.Language { - _FakeLanguage_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_10(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWeightUnit_11 extends _i1.SmartFake implements _i11.WeightUnit { - _FakeWeightUnit_11(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_11(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_12 extends _i1.SmartFake implements _i12.RepetitionUnit { +class _FakeRepetitionUnit_12 extends _i1.SmartFake + implements _i12.RepetitionUnit { _FakeRepetitionUnit_12(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_13 extends _i1.SmartFake implements _i13.Routine { - _FakeRoutine_13(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_13(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_14 extends _i1.SmartFake implements _i14.Day { - _FakeDay_14(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_14(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_15 extends _i1.SmartFake implements _i15.Slot { - _FakeSlot_15(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_15(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_16 extends _i1.SmartFake implements _i16.SlotEntry { - _FakeSlotEntry_16(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_16(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_17 extends _i1.SmartFake implements _i17.BaseConfig { - _FakeBaseConfig_17(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_17(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_18 extends _i1.SmartFake implements _i18.WorkoutSession { +class _FakeWorkoutSession_18 extends _i1.SmartFake + implements _i18.WorkoutSession { _FakeWorkoutSession_18(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_19 extends _i1.SmartFake implements _i19.Log { - _FakeLog_19(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_19(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [WgerBaseProvider]. @@ -155,14 +174,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); @@ -343,22 +362,23 @@ class MockExercisesProvider extends _i1.Mock implements _i21.ExercisesProvider { as List<_i10.Language>); @override - set database(_i5.ExerciseDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set exercises(List<_i6.Exercise>? value) => super.noSuchMethod( - Invocation.setter(#exercises, value), + set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter(#exercises, _exercises), returnValueForMissingStub: null, ); @override - set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); + set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => + super.noSuchMethod( + Invocation.setter(#filteredExercises, newFilteredExercises), + returnValueForMissingStub: null, + ); @override set languages(List<_i10.Language>? languages) => super.noSuchMethod( @@ -368,7 +388,8 @@ class MockExercisesProvider extends _i1.Mock implements _i21.ExercisesProvider { @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i20.Future setFilters(_i21.Filters? newFilters) => @@ -744,8 +765,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i23.RoutinesProvider { as _i12.RepetitionUnit); @override - set activeRoutine(_i13.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i13.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -756,14 +777,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i23.RoutinesProvider { ); @override - set repetitionUnits(List<_i12.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i12.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/gym_mode_session_screen_test.mocks.dart b/test/routine/gym_mode_session_screen_test.mocks.dart index 0248af2ce..43460e2c4 100644 --- a/test/routine/gym_mode_session_screen_test.mocks.dart +++ b/test/routine/gym_mode_session_screen_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/repetition_unit_form_widget_test.mocks.dart b/test/routine/repetition_unit_form_widget_test.mocks.dart index db1176970..076938675 100644 --- a/test/routine/repetition_unit_form_widget_test.mocks.dart +++ b/test/routine/repetition_unit_form_widget_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/routine_edit_screen_test.mocks.dart b/test/routine/routine_edit_screen_test.mocks.dart index 4c31c99c8..f486f7b99 100644 --- a/test/routine/routine_edit_screen_test.mocks.dart +++ b/test/routine/routine_edit_screen_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/routine_edit_test.mocks.dart b/test/routine/routine_edit_test.mocks.dart index 17bc27bd9..ae62e6b03 100644 --- a/test/routine/routine_edit_test.mocks.dart +++ b/test/routine/routine_edit_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/routine_form_test.mocks.dart b/test/routine/routine_form_test.mocks.dart index 6ecdd2f3a..1c7158e62 100644 --- a/test/routine/routine_form_test.mocks.dart +++ b/test/routine/routine_form_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/routine_logs_screen_test.mocks.dart b/test/routine/routine_logs_screen_test.mocks.dart index dca48e937..5eaed5dab 100644 --- a/test/routine/routine_logs_screen_test.mocks.dart +++ b/test/routine/routine_logs_screen_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/routine_screen_test.mocks.dart b/test/routine/routine_screen_test.mocks.dart index 99fe1643b..de59b077d 100644 --- a/test/routine/routine_screen_test.mocks.dart +++ b/test/routine/routine_screen_test.mocks.dart @@ -23,22 +23,25 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [WgerBaseProvider]. @@ -66,14 +69,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/routine/routines_provider_test.mocks.dart b/test/routine/routines_provider_test.mocks.dart index 063265063..6a756b7b3 100644 --- a/test/routine/routines_provider_test.mocks.dart +++ b/test/routine/routines_provider_test.mocks.dart @@ -31,53 +31,63 @@ import 'package:wger/providers/exercises.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider { +class _FakeWgerBaseProvider_4 extends _i1.SmartFake + implements _i4.WgerBaseProvider { _FakeWgerBaseProvider_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeExerciseDatabase_5 extends _i1.SmartFake implements _i5.ExerciseDatabase { +class _FakeExerciseDatabase_5 extends _i1.SmartFake + implements _i5.ExerciseDatabase { _FakeExerciseDatabase_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeExercise_6 extends _i1.SmartFake implements _i6.Exercise { - _FakeExercise_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeExerciseCategory_7 extends _i1.SmartFake implements _i7.ExerciseCategory { +class _FakeExerciseCategory_7 extends _i1.SmartFake + implements _i7.ExerciseCategory { _FakeExerciseCategory_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeEquipment_8 extends _i1.SmartFake implements _i8.Equipment { - _FakeEquipment_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_8(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMuscle_9 extends _i1.SmartFake implements _i9.Muscle { - _FakeMuscle_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeLanguage_10 extends _i1.SmartFake implements _i10.Language { - _FakeLanguage_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_10(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [WgerBaseProvider]. @@ -105,14 +115,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); @@ -293,22 +303,23 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { as List<_i10.Language>); @override - set database(_i5.ExerciseDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set exercises(List<_i6.Exercise>? value) => super.noSuchMethod( - Invocation.setter(#exercises, value), + set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter(#exercises, _exercises), returnValueForMissingStub: null, ); @override - set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); + set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => + super.noSuchMethod( + Invocation.setter(#filteredExercises, newFilteredExercises), + returnValueForMissingStub: null, + ); @override set languages(List<_i10.Language>? languages) => super.noSuchMethod( @@ -318,7 +329,8 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i11.Future setFilters(_i12.Filters? newFilters) => diff --git a/test/routine/routines_screen_test.mocks.dart b/test/routine/routines_screen_test.mocks.dart index 2607f048f..534b4ac8f 100644 --- a/test/routine/routines_screen_test.mocks.dart +++ b/test/routine/routines_screen_test.mocks.dart @@ -23,22 +23,25 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [WgerBaseProvider]. @@ -66,14 +69,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/routine/slot_entry_form_test.mocks.dart b/test/routine/slot_entry_form_test.mocks.dart index 6b9d61ac4..d9e4d7217 100644 --- a/test/routine/slot_entry_form_test.mocks.dart +++ b/test/routine/slot_entry_form_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/routine/weight_unit_form_widget_test.mocks.dart b/test/routine/weight_unit_form_widget_test.mocks.dart index bfb4febb8..8f8c332c4 100644 --- a/test/routine/weight_unit_form_widget_test.mocks.dart +++ b/test/routine/weight_unit_form_widget_test.mocks.dart @@ -35,49 +35,58 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { +class _FakeRepetitionUnit_2 extends _i1.SmartFake + implements _i4.RepetitionUnit { _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { +class _FakeWorkoutSession_8 extends _i1.SmartFake + implements _i10.WorkoutSession { _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [RoutinesProvider]. @@ -146,8 +155,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { as _i4.RepetitionUnit); @override - set activeRoutine(_i5.Routine? value) => super.noSuchMethod( - Invocation.setter(#activeRoutine, value), + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter(#activeRoutine, _activeRoutine), returnValueForMissingStub: null, ); @@ -158,14 +167,16 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ); @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => + super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/user/provider_test.mocks.dart b/test/user/provider_test.mocks.dart index 08bbf6366..c0b363ab8 100644 --- a/test/user/provider_test.mocks.dart +++ b/test/user/provider_test.mocks.dart @@ -23,7 +23,6 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); @@ -66,14 +65,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/weight/weight_provider_test.mocks.dart b/test/weight/weight_provider_test.mocks.dart index 4cd18bb56..3dcee51b0 100644 --- a/test/weight/weight_provider_test.mocks.dart +++ b/test/weight/weight_provider_test.mocks.dart @@ -23,7 +23,6 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); @@ -66,14 +65,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { as _i3.Client); @override - set auth(_i2.AuthProvider? value) => super.noSuchMethod( - Invocation.setter(#auth, value), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter(#auth, _auth), returnValueForMissingStub: null, ); @override - set client(_i3.Client? value) => super.noSuchMethod( - Invocation.setter(#client, value), + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter(#client, _client), returnValueForMissingStub: null, ); diff --git a/test/weight/weight_screen_test.mocks.dart b/test/weight/weight_screen_test.mocks.dart index fe89a5052..c333a2cb2 100644 --- a/test/weight/weight_screen_test.mocks.dart +++ b/test/weight/weight_screen_test.mocks.dart @@ -32,38 +32,44 @@ import 'package:wger/providers/user.dart' as _i9; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -// ignore_for_file: invalid_use_of_internal_member -class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { +class _FakeWgerBaseProvider_0 extends _i1.SmartFake + implements _i2.WgerBaseProvider { _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeSharedPreferencesAsync_1 extends _i1.SmartFake implements _i3.SharedPreferencesAsync { +class _FakeSharedPreferencesAsync_1 extends _i1.SmartFake + implements _i3.SharedPreferencesAsync { _FakeSharedPreferencesAsync_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeIngredientDatabase_2 extends _i1.SmartFake implements _i4.IngredientDatabase { +class _FakeIngredientDatabase_2 extends _i1.SmartFake + implements _i4.IngredientDatabase { _FakeIngredientDatabase_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeNutritionalPlan_3 extends _i1.SmartFake implements _i5.NutritionalPlan { +class _FakeNutritionalPlan_3 extends _i1.SmartFake + implements _i5.NutritionalPlan { _FakeNutritionalPlan_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } class _FakeMeal_4 extends _i1.SmartFake implements _i6.Meal { - _FakeMeal_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMeal_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMealItem_5 extends _i1.SmartFake implements _i7.MealItem { - _FakeMealItem_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMealItem_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeIngredient_6 extends _i1.SmartFake implements _i8.Ingredient { - _FakeIngredient_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeIngredient_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [UserProvider]. @@ -105,26 +111,27 @@ class MockUserProvider extends _i1.Mock implements _i9.UserProvider { as _i3.SharedPreferencesAsync); @override - set themeMode(_i10.ThemeMode? value) => super.noSuchMethod( - Invocation.setter(#themeMode, value), + set themeMode(_i10.ThemeMode? _themeMode) => super.noSuchMethod( + Invocation.setter(#themeMode, _themeMode), returnValueForMissingStub: null, ); @override - set prefs(_i3.SharedPreferencesAsync? value) => super.noSuchMethod( - Invocation.setter(#prefs, value), + set prefs(_i3.SharedPreferencesAsync? _prefs) => super.noSuchMethod( + Invocation.setter(#prefs, _prefs), returnValueForMissingStub: null, ); @override - set profile(_i11.Profile? value) => super.noSuchMethod( - Invocation.setter(#profile, value), + set profile(_i11.Profile? _profile) => super.noSuchMethod( + Invocation.setter(#profile, _profile), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( @@ -193,7 +200,8 @@ class MockUserProvider extends _i1.Mock implements _i9.UserProvider { /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock implements _i14.NutritionPlansProvider { +class MockNutritionPlansProvider extends _i1.Mock + implements _i14.NutritionPlansProvider { MockNutritionPlansProvider() { _i1.throwOnMissingStub(this); } @@ -237,20 +245,21 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i14.NutritionPlans as List<_i5.NutritionalPlan>); @override - set database(_i4.IngredientDatabase? value) => super.noSuchMethod( - Invocation.setter(#database, value), + set database(_i4.IngredientDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), returnValueForMissingStub: null, ); @override - set ingredients(List<_i8.Ingredient>? value) => super.noSuchMethod( - Invocation.setter(#ingredients, value), + set ingredients(List<_i8.Ingredient>? _ingredients) => super.noSuchMethod( + Invocation.setter(#ingredients, _ingredients), returnValueForMissingStub: null, ); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override void clear() => super.noSuchMethod( diff --git a/test/widgets/routines/plate_calculator_test.dart b/test/widgets/routines/plate_calculator_test.dart index 9c1b7ad00..bd2f4275c 100644 --- a/test/widgets/routines/plate_calculator_test.dart +++ b/test/widgets/routines/plate_calculator_test.dart @@ -53,8 +53,6 @@ void main() { selectedPlates: [1.25, 2.5], ); - await pumpWidget(tester, notifier: notifier); - // Correctly changes the unit expect(notifier.state.isMetric, isTrue); await tester.tap(find.byKey(const ValueKey('weightUnitDropdown')));