This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 4 files changed +30
-10
lines changed
lib/src/engine/platform_views
test/engine/platform_views
4 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,10 @@ class PlatformViewMessageHandler {
73
73
if (! _contentManager.knowsViewType (viewType)) {
74
74
callback (_codec.encodeErrorEnvelope (
75
75
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.' ,
78
80
));
79
81
return ;
80
82
}
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ void testMain() {
46
46
codec.decodeEnvelope (response! );
47
47
} on PlatformException catch (e) {
48
48
expect (e.code, 'unregistered_view_type' );
49
- expect (e.details, contains (viewType));
49
+ expect (e.message, contains (viewType));
50
+ expect (e.details, contains ('registerViewFactory' ));
50
51
}
51
52
});
52
53
Original file line number Diff line number Diff line change 129
129
NSDictionary <NSString *, id >* args = [call arguments ];
130
130
131
131
long viewId = [args[@" id" ] longValue ];
132
- std::string viewType ([args[@" viewType" ] UTF8String ]);
132
+ NSString * viewTypeString = args[@" viewType" ];
133
+ std::string viewType (viewTypeString.UTF8String );
133
134
134
135
if (views_.count (viewId) != 0 ) {
135
136
result ([FlutterError errorWithCode: @" recreating_view"
139
140
140
141
NSObject <FlutterPlatformViewFactory>* factory = factories_[viewType].get ();
141
142
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`." ]);
146
155
return ;
147
156
}
148
157
Original file line number Diff line number Diff line change @@ -39,8 +39,16 @@ - (void)onCreateWithViewID:(int64_t)viewId
39
39
if (!factory) {
40
40
result ([FlutterError
41
41
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`." ]);
44
52
return ;
45
53
}
46
54
You can’t perform that action at this time.
0 commit comments