Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 17c89b6

Browse files
committed
Update "unregistered_view_type" error message based on PR review
1 parent db68a6e commit 17c89b6

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

lib/web_ui/lib/src/engine/platform_views/message_handler.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ class PlatformViewMessageHandler {
7373
if (!_contentManager.knowsViewType(viewType)) {
7474
callback(_codec.encodeErrorEnvelope(
7575
code: 'unregistered_view_type',
76-
message: 'trying to create a view with an unregistered type. '
77-
'Have you called GeneratedPluginRegistrant.register?',
78-
details: 'unregistered view type: $viewType',
76+
message: 'A HtmlElementView widget is trying to create a platform view'
77+
' with an unregistered type: <$viewType>.',
78+
details: 'If you are the author of the PlatformView, make sure '
79+
'`registerViewFactory` is invoked.',
7980
));
8081
return;
8182
}

shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,11 @@
140140
NSObject<FlutterPlatformViewFactory>* factory = factories_[viewType].get();
141141
if (factory == nil) {
142142
result([FlutterError errorWithCode:@"unregistered_view_type"
143-
message:@"trying to create a view with an unregistered type. Have "
144-
@"you called GeneratedPluginRegistrant.register?"
145-
details:[NSString stringWithFormat:@"unregistered view type: '%@'",
146-
args[@"viewType"]]]);
143+
message:[NSString stringWithFormat:@"A UIKitView widget is trying to create a PlatformView with an unregistered type: < %@ >", viewType]
144+
details:@"If you are the author of the PlatformView, make sure `registerViewFactory` is invoked.\n"
145+
@"See: https://docs.flutter.dev/development/platform-integration/platform-views?tab=ios-platform-views-objective-c-tab#on-the-platform-side-1 for more details."
146+
@"If you are not the author of the PlatformView, make sure to call "
147+
@"`GeneratedPluginRegistrant.register`."]);
147148
return;
148149
}
149150

shell/platform/darwin/macos/framework/Source/FlutterPlatformViewController.mm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ - (void)onCreateWithViewID:(int64_t)viewId
3737

3838
NSObject<FlutterPlatformViewFactory>* factory = _platformViewFactories[viewType];
3939
if (!factory) {
40-
result([FlutterError
41-
errorWithCode:@"unregistered_view_type"
42-
message:@"trying to create a view with an unregistered type. Have you called "
43-
@"GeneratedPluginRegistrant.register?"
44-
details:[NSString stringWithFormat:@"unregistered view type: '%@'", viewType]]);
40+
result([FlutterError errorWithCode:@"unregistered_view_type"
41+
message:[NSString stringWithFormat:@"A UIKitView widget is trying to create a PlatformView with an unregistered type: < %@ >", viewType]
42+
details:@"If you are the author of the PlatformView, make sure `registerViewFactory` is invoked.\n"
43+
@"See: https://docs.flutter.dev/development/platform-integration/platform-views?tab=ios-platform-views-objective-c-tab#on-the-platform-side-1 for more details."
44+
@"If you are not the author of the PlatformView, make sure to call "
45+
@"`GeneratedPluginRegistrant.register`."]);
4546
return;
4647
}
4748

0 commit comments

Comments
 (0)