Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
MVVM から MVVM-C に変えてみた話 〜画面遷移どうしてる?〜
Search
Ricky-yu
November 18, 2025
Programming
360
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MVVM から MVVM-C に変えてみた話 〜画面遷移どうしてる?〜
Ricky-yu
November 18, 2025
Other Decks in Programming
See All in Programming
ChromeでローカルLLM
ryu1013
0
200
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
5.8k
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
160
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
110
Getting Started with Vibe Coding
miccheng
0
190
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
300
Event is what happens
moro
2
4k
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
150
はじめてのPLATEAU
nokonoko1203
1
630
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
210
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
330
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
130
Featured
See All Featured
Prompt Engineering for Job Search
mfonobong
0
580
Thoughts on Productivity
jonyablonski
76
5.5k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
68k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
KATA
mclloyd
PRO
35
16k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
Designing for Timeless Needs
cassininazir
1
550
Exploring anti-patterns in Rails
aemeredith
4
560
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Into the Great Unknown - MozCon
thekraken
41
2.8k
Transcript
MVVM から MVVM-C に変えてみた話 〜 画面遷移どうしてる?〜
1. MVVMのおさらい 2. 実際どんな構成になったか 3. 事例の紹介 4. なぜCoordinatorがいるのか? 5. 導入に当たって検討すべきこと
自己紹介 - iOSエンジニア-> 現在Flutterエンジニア 株式会社Linc’well - 前職iOS開発経験では(MVC→VIPER への移行経験あり) - Flutterの個人開発でも仕事でもMVVMアーキテクチャ 陳 信瑜
GitHub ID: Ricky-yu
MVVM構成の復習 ・UIロジックとビジネスロジックを分離できるメ リット ・ただし「画面遷移の責務」はどこに置くかが 曖昧になりがち Model データ構造とビジネスロジックを担当 アプリケーションのデータ操作と永続化を処理 View UIコンポーネントとユーザー操作の受付
Flutter Widgetとして実装 ViewModel ビューの状態管理とビジネスロジック連携 Riverpodプロバイダーとして実装
MVVM課題の整理(責務が混在/テスト困難) ・ViewModelがUI遷移まで担当してしまう ・画面遷移は Viewにあるとテストしづらい ・画面遷移が増えるほどメンテナンスコスト増 ・外部リンク遷移がビジネスロジックに混ざり、保守性低下
MVVM-Cの導入アイデア ・iOS開発でMVC→VIPERへ移行した際も「遷移の責務分離」は共通課題 ・Flutterにも同じ思想を応用できるのでは? ・MVVMにCoordinatorを追加して遷移を一元管理できるのでは?( MVVM-C)
MVVM-C フレームワークの基本構造 MVVMCはModel-View-ViewModel-Coordinatorの略で、 従来のMVVMパターンにCoordinatorレイヤーを追加したアーキテクチャです。 View Coordinator 画面遷移とアプリフロー制御 ナビゲーション責務の一元管理 ViewModel Model
取り組んだ事例
実例1:画面遷移テストの実施が困難 class _HomeViewState extends State<HomeView> { onTap: () async {
// ❌ 問題:onTap 内で非同期処理+画面遷移を直接実装 // 処理状態のダイアログを表示。 CommonUtils.showProgressDialog(context); // 2秒待機、ダイヤログを消す。 await Future<dynamic>.delayed(Duration(seconds: 2)); Navigator.of(context).pop(); // 次の画面へ遷移する。 Get.to(BirthdayTestView(), }, }
画面遷移テスト(Before) testWidgets('HomeView Test', (WidgetTester tester) async { getPages: [ //
❌ ルーティング設定 が必要です。 GetPage(name: '/birthday', page: () => BirthdayTestView()), GetPage(name: '/fingerprint', page: () => FingerPrintTestView()), ], await tester.tap(find.text('Date_Fortune_Tell'.tr)); await tester.pump(Duration(seconds: 2)); // ❌ 2秒を待つ必要。 await tester.pumpAndSettle(); //❌ アニメーション完了を 待つ必要。 // ❌ 正しいページに遷移したかどうかを検証するのが難しい。 expect(find.byType(BirthdayTestView), findsOneWidget); }
画面遷移テスト(After)画面遷移テストがシンプル・高速・安定に testWidgets('HomeView Test(Mock Coordinator)', (WidgetTester tester) async { final mockCoordinator
= MockHomeCoordinator(); Get.put<HomeCoordinator>(mockCoordinator); // ✅ View 本体だけをテストすればよい await tester.pumpWidget( GetMaterialApp(home: HomeView()), ); // ✅ ボタンをタップするだけに await tester.tap(find.text('Date_Fortune_Tell'.tr)); // ✅ 正しい Coordinator のメソッドが呼び出されたかを検証する verify(mockCoordinator.navigateToBirthdayTest()).called(1); }
実例2:同一フロー内で遷移管理が分散 HomeView TestList View TestList DetailView TestResult View 画面遷移 テスト
画面遷移 テスト 画面遷移 テスト 画面遷移 テスト
実例2:同一フロー内で遷移管理が分散(After) HomeView TestList View TestList Detail View TestResul tView 画面遷移テスト
TestFlowCoordinator
なぜCoordinatorがいるのか? ・UIに依存しない、遷移ロジックの検証が可能。 ・遷移ロジックを集中管理できます。 ・遷移の追跡がしやすくなります。
導入にあたって検討すべきポイント • 画面遷移の依存関係 現在の画面遷移は View または ViewModel のどちらに依存しているかを確認する。 (View に依存している
→ Coordinator 導入の効果が大きい) • 遷移経路の複数性 複数のフローからその画面に遷移される可能性があるかを確認する。 (例:通知/ディープリンク/通常遷移など) • 遷移ロジックの複雑さ 条件分岐や状態管理を伴う遷移ロジックが複雑になっていないかを確認する。 • チーム方針 アーキテクチャは「正解」ではなく「哲学」。 チームの開発方針・保守性・テスト戦略に合わせて実装方針を検討する。
16 ©Linc' well inc. クリフォアアプリについて クリフォアアプリ • Linc’wellが提供するサービスをまとめたアプリ • オンライン・オフラインの診療予約
• ヘルスケア製品の購入 • 服薬管理機能 • 体重管理サポート • MVVM+Coordinator導入中 • Flutterエンジニア採用中 • FlutterKaigi 2025 出展中
以上 ありがとうございました。