Skip to content

Commit

Permalink
refactor: run dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
emusute1212 committed Jul 29, 2023
1 parent 7695f36 commit ec84513
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
- uses: subosito/flutter-action@v1
- name: Download Flutter packages
run: flutter pub get
- name: Flutter format
run: flutter format --set-exit-if-changed
- name: dart format
run: dart format -o none --set-exit-if-changed .
- name: Flutter analyze
run: flutter analyze --fatal-infos --fatal-warnings
- name: Flutter test
Expand Down
1 change: 0 additions & 1 deletion lib/data/db/my_keep_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class StockItems extends Table {

@DriftDatabase(tables: [StockItems])
class MyKeepDatabase extends _$MyKeepDatabase {

MyKeepDatabase() : super(_openConnection());

MyKeepDatabase.withQueryExecutor(QueryExecutor e) : super(e);
Expand Down
2 changes: 1 addition & 1 deletion lib/data/entity/ogp_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class OgpEntity with _$OgpEntity {

factory OgpEntity.fromJson(Map<String, Object?> json) =>
_$OgpEntityFromJson(json);
}
}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ void main() {
child: App(),
),
);
}
}
10 changes: 5 additions & 5 deletions lib/ui/adding/adding_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import 'package:mykeep/usecase/my_keep_usecase.dart';
import 'package:string_validator/string_validator.dart';

final addingViewModelProvider =
StateNotifierProvider<AddingViewModel, AddingState>(
StateNotifierProvider<AddingViewModel, AddingState>(
(ref) => AddingViewModel(ref.read(myKeepUsecaseyProvider)));

class AddingViewModel extends StateNotifier<AddingState> {
final MyKeepUsecase _usecase;

AddingViewModel(this._usecase)
: super(const AddingState(
url: "",
title: "",
isPossibleToSave: false,
));
url: "",
title: "",
isPossibleToSave: false,
));

Future<bool> addKeepItem(String targetUrl) async {
bool isSuccess = await _usecase.addKeepItem(targetUrl);
Expand Down
4 changes: 1 addition & 3 deletions lib/ui/mystock/my_stock_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ class MyStockViewModel extends StateNotifier<MyStockState> {

void init() {
_usecase.observeKeepItem().listen((event) {
state = state.copyWith(
items: event
);
state = state.copyWith(items: event);
});
}

Expand Down
8 changes: 5 additions & 3 deletions test/ogp_repository_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import 'package:mykeep/data/repository/ogp_repository.dart';
void main() {
test('OGPが存在するサイトのテスト', () async {
final ogpRepository = OgpRepository();
final result = await ogpRepository.loadOgpEntity("https://qiita.com/emusute1212");
final result =
await ogpRepository.loadOgpEntity("https://qiita.com/emusute1212");

expect(result.title, '@emusute1212のマイページ - Qiita');
expect(result.imageUrl, 'https://cdn.qiita.com/assets/qiita-ogp-3b6fcfdd74755a85107071ffc3155898.png');
expect(result.imageUrl,
'https://cdn.qiita.com/assets/qiita-ogp-3b6fcfdd74755a85107071ffc3155898.png');
});
test('OGPが存在しないサイトのテスト', () async {
final ogpRepository = OgpRepository();
Expand All @@ -24,4 +26,4 @@ void main() {
expect(result.title, 'Undefined');
expect(result.imageUrl, null);
});
}
}

0 comments on commit ec84513

Please sign in to comment.