Skip to content

iOS add-to-app fullscreen example can not hot reload until hot restart #94681

@SShayashi

Description

@SShayashi

Overview

When I run hot reload in add-to-app fullscreen example in iOS, it can not work showing the following error. However, after running hot restart, hot reload worked.

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY
╞═══════════════════════════════════════════════════════════
The following NoSuchMethodError was thrown building MyApp(dirty):
No constructor 'MaterialApp.' with matching arguments declared in class 'MaterialApp'.
Receiver: MaterialApp
Tried calling: new MaterialApp.()
Found: new MaterialApp.({Key? key, GlobalKey<NavigatorState>? navigatorKey,
GlobalKey<ScaffoldMessengerState>? scaffoldMessengerKey, Widget? home, Map<String,
(BuildContext) =>
Widget> routes, String? initialRoute, ((RouteSettings) => Route<dynamic>?)?
onGenerateRoute,
((String) => List<Route<dynamic>>)? onGenerateInitialRoutes, ((RouteSettings) =>
Route<dynamic>?)?
onUnknownRoute, List<NavigatorObserver> navigatorObservers, ((BuildContext, Widget?) =>
Widget)?
builder, String title, ((BuildContext) => String)? onGenerateTitle, Color? color,
ThemeData? theme,
ThemeData? darkTheme, ThemeData? highContrastTheme, ThemeData? highContrastDarkTheme,
ThemeMode?
themeMode, Locale? locale, Iterable<LocalizationsDelegate<dynamic>>?
localizationsDelegates,
((List<Locale>?, Iterable<Locale>) => Locale?)? localeListResolutionCallback,
((Locale?,
Iterable<Locale>) => Locale?)? localeResolutionCallback, Iterable<Locale>
supportedLocales, bool
debugShowMaterialGrid, bool showPerformanceOverlay, bool checkerboardRasterCacheImages,
bool
checkerboardOffscreenLayers, bool showSemanticsDebugger, bool
debugShowCheckedModeBanner,
Map<ShortcutActivator, Intent>? shortcuts, Map<Type, Action<Intent>>? actions, String?
restorationScopeId, ScrollBehavior? scrollBehavior, bool useInheritedMediaQuery}) =>
MaterialApp

Widget creation tracking is currently disabled. Enabling it enables improved error
messages. It can
be enabled by passing `--track-widget-creation` to `flutter run` or `flutter test`.

When the exception was thrown, this was the stack:
#0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:214:5)
#1      MyApp.build (package:flutter_module/main.dart)
#2      StatelessElement.build (package:flutter/src/widgets/framework.dart:4739:28)
#3      ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:4665:15)
#4      Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#5      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2620:33)
#6      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21)
#7      RendererBinding._handlePersistentFrameCallback
(package:flutter/src/rendering/binding.dart:319:5)
#8      SchedulerBinding._invokeFrameCallback
(package:flutter/src/scheduler/binding.dart:1143:15)
#9      SchedulerBinding.handleDrawFrame
(package:flutter/src/scheduler/binding.dart:1080:9)
#10     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure>
(package:flutter/src/scheduler/binding.dart:863:7)
(elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)

═══════════════════════════════════════════════════════════════════════════════════════
═════════════
Performing hot reload...
Reloaded 1 of 569 libraries in 345ms.
flutter doctor -v
$ flutter doctor -v
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.5.2 20G95 darwin-x64, locale ja)
    • Flutter version 2.5.1 at /Users/sshayashi/fvm/versions/2.5.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (2 months ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/sshayashi/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode13beta5.app/Contents/Developer
    • Xcode 13.0, Build version 13A5212g
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 51.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.60.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.27.0

[✓] Connected device (2 available)
    • iPod touch (7th generation) (mobile) • C830390E-B470-4EC4-9F15-23477CACF678 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)
    • Chrome (web)                         • chrome                               • web-javascript • Google Chrome 96.0.4664.55

• No issues found!
sshayashi@MacBook-Pro:~/Programs/baseline_reprodution »

How to reproduce

git clone --depth 1 https://github.com/flutter/samples.git
cd samples/add_to_app/fullscreen/flutter_module/
flutter pub get
cd ../ios_fullscreen
pod install
open IOSFullScreen.xcworkspace
# run IOSFullScreen app

cd ../flutter_module
flutter attach
# change something and run hot reload
# show the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: existing-appsIntegration with existing apps via the add-to-app flowplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versiont: hot reloadReloading code during "flutter run"toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions