body method
Defines the actual body code. path
is passed relative to lib
, baseName
is the filename, and className
is the filename converted to Pascal case.
実際の本体コードを定義します。path
にlib
からの相対パス、baseName
にファイル名が渡され、className
にファイル名をパスカルケースに変換した値が渡されます。
Implementation
@override
String body(String path, String baseName, String className) {
return """
/// Describe the page to be displayed when the application is launched.
///
/// By passing this object to the `boot` parameter of AppRouter, the processing of this class will be executed when the application starts.
///
/// ```dart
/// final router = AppRouter(
/// boot: const Boot(),
/// );
/// ```
@immutable
class Boot extends BootRouteQueryBuilder {
const Boot({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
// TODO: Describe the screen to be displayed when the process is first implemented.
);
}
@override
FutureOr<void> onInit(BuildContext context) async {
// TODO: Describe the initialization process.
await Future.delayed(2.s);
}
@override
void onError(BuildContext context, BootRef ref, Object error, StackTrace stackTrace) {
// TODO: Describe the error process.
}
@override
TransitionQuery get initialTransitionQuery => TransitionQuery.fade;
}
""";
}