File tree Expand file tree Collapse file tree 4 files changed +30
-10
lines changed
lib/src/engine/platform_views
test/engine/platform_views Expand file tree Collapse file tree 4 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -73,8 +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- 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.' ,
7880 ));
7981 return ;
8082 }
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ void testMain() {
4646 codec.decodeEnvelope (response! );
4747 } on PlatformException catch (e) {
4848 expect (e.code, 'unregistered_view_type' );
49- expect (e.details, contains (viewType));
49+ expect (e.message, contains (viewType));
50+ expect (e.details, contains ('registerViewFactory' ));
5051 }
5152 });
5253
Original file line number Diff line number Diff line change 129129 NSDictionary <NSString *, id >* args = [call arguments ];
130130
131131 long viewId = [args[@" id" ] longValue ];
132- std::string viewType ([args[@" viewType" ] UTF8String ]);
132+ NSString * viewTypeString = args[@" viewType" ];
133+ std::string viewType (viewTypeString.UTF8String );
133134
134135 if (views_.count (viewId) != 0 ) {
135136 result ([FlutterError errorWithCode: @" recreating_view"
139140
140141 NSObject <FlutterPlatformViewFactory>* factory = factories_[viewType].get ();
141142 if (factory == nil ) {
142- result ([FlutterError errorWithCode: @" unregistered_view_type"
143- message: @" trying to create a view with an unregistered type"
144- details: [NSString stringWithFormat: @" unregistered view type: '%@ '" ,
145- args[@" viewType" ]]]);
143+ result ([FlutterError
144+ errorWithCode: @" unregistered_view_type"
145+ message: [NSString stringWithFormat: @" A UIKitView widget is trying to create a "
146+ @" PlatformView with an unregistered type: < %@ >" ,
147+ viewTypeString]
148+ details: @" If you are the author of the PlatformView, make sure `registerViewFactory` "
149+ @" is invoked.\n "
150+ @" See: "
151+ @" https://docs.flutter.dev/development/platform-integration/"
152+ @" platform-views#on-the-platform-side-1 for more details.\n "
153+ @" If you are not the author of the PlatformView, make sure to call "
154+ @" `GeneratedPluginRegistrant.register`." ]);
146155 return ;
147156 }
148157
Original file line number Diff line number Diff line change @@ -39,8 +39,16 @@ - (void)onCreateWithViewID:(int64_t)viewId
3939 if (!factory) {
4040 result ([FlutterError
4141 errorWithCode: @" unregistered_view_type"
42- message: @" trying to create a view with an unregistered type"
43- details: [NSString stringWithFormat: @" unregistered view type: '%@ '" , viewType]]);
42+ message: [NSString stringWithFormat: @" A UIKitView widget is trying to create a "
43+ @" PlatformView with an unregistered type: < %@ >" ,
44+ viewType]
45+ details: @" If you are the author of the PlatformView, make sure `registerViewFactory` "
46+ @" is invoked.\n "
47+ @" See: "
48+ @" https://docs.flutter.dev/development/platform-integration/"
49+ @" platform-views#on-the-platform-side-1 for more details.\n "
50+ @" If you are not the author of the PlatformView, make sure to call "
51+ @" `GeneratedPluginRegistrant.register`." ]);
4452 return ;
4553 }
4654
You can’t perform that action at this time.
0 commit comments