Skip to content

Commit

Permalink
feat: Changed the specification of runMasamuneApp.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Mar 9, 2023
1 parent 4334f5c commit 0f6d3cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/masamune/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const flavor = String.fromEnvironment("FLAVOR");
/// App.
void main() {
runMasamuneApp(
() => MasamuneApp(
(adapters) => MasamuneApp(
title: title,
appRef: appRef,
theme: theme,
Expand All @@ -135,6 +135,7 @@ void main() {
modelAdapter: modelAdapter,
storageAdapter: storageAdapter,
functionsAdapter: functionsAdapter,
masamuneAdapters: adapters,
),
);
}
10 changes: 5 additions & 5 deletions packages/masamune/lib/src/masamune_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const kDefaultLocales = [Locale("en", "US")];
///
/// Passing [masamuneAdapters] makes it easy to use additional plug-ins for the Masamune Framework.
///
/// (If [masamuneAdapters] is specified, [masamuneAdapters] must also be passed in [MasamuneApp].
/// (If [masamuneAdapters] is specified, `adapters` must also be passed in [MasamuneApp].
///
/// Set [setPathUrlStrategy] to `true` to remove `#` in the web path.
///
Expand All @@ -24,11 +24,11 @@ const kDefaultLocales = [Locale("en", "US")];
/// [masamuneApp][MasamuneApp]を渡すことで内部で[runApp]を実行します。
///
/// [masamuneAdapters]を渡すことでMasamune Frameworkの追加プラグインを楽に利用することができます。
/// ([masamuneAdapters]を指定する場合は[MasamuneApp]内でも[masamuneAdapters]を渡してください。)
/// ([masamuneAdapters]を指定する場合は[MasamuneApp]内でも`adapters`を渡してください。)
///
/// [setPathUrlStrategy]`true`にするとWebのパス中の`#`を取り除くことができます。
Future<void> runMasamuneApp(
MasamuneApp Function() masamuneApp, {
MasamuneApp Function(List<MasamuneAdapter> adapters) masamuneApp, {
bool setPathUrlStrategy = true,
List<MasamuneAdapter> masamuneAdapters = const [],
}) async {
Expand All @@ -42,7 +42,7 @@ Future<void> runMasamuneApp(
for (final adapter in masamuneAdapters) {
await adapter.onPreRunApp();
}
runApp(masamuneApp.call());
runApp(masamuneApp.call(masamuneAdapters));
}, (error, stack) {
for (final adapter in masamuneAdapters) {
adapter.onError(error, stack);
Expand All @@ -52,7 +52,7 @@ Future<void> runMasamuneApp(
for (final adapter in masamuneAdapters) {
await adapter.onPreRunApp();
}
runApp(masamuneApp.call());
runApp(masamuneApp.call(masamuneAdapters));
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/masamune/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ packages:
dependency: "direct main"
description:
name: katana_model
sha256: "4f62900759b58c77bc8a8d33c65d6c9be35e97f7c9b152db016d55e0ebba9673"
sha256: f53f7e628729830f1bdf3761e2a439918dd4c797ac50c09cf7596bdf6b114254
url: "https://pub.dev"
source: hosted
version: "1.5.14"
version: "1.5.15"
katana_prefs:
dependency: "direct main"
description:
Expand Down

0 comments on commit 0f6d3cd

Please sign in to comment.