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

Commit 028deae

Browse files
authored
[ios] Convert int in Dart to long long in Objective-C. (#39331)
For native targets, an `int` in Dart maps to a signed 64-bit integer representation.
1 parent b9073d1 commit 028deae

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,14 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
193193
void FlutterPlatformViewsController::OnCreate(FlutterMethodCall* call, FlutterResult& result) {
194194
NSDictionary<NSString*, id>* args = [call arguments];
195195

196-
long viewId = [args[@"id"] longValue];
196+
int64_t viewId = [args[@"id"] longLongValue];
197197
NSString* viewTypeString = args[@"viewType"];
198198
std::string viewType(viewTypeString.UTF8String);
199199

200200
if (views_.count(viewId) != 0) {
201201
result([FlutterError errorWithCode:@"recreating_view"
202202
message:@"trying to create an already created view"
203-
details:[NSString stringWithFormat:@"view id: '%ld'", viewId]]);
203+
details:[NSString stringWithFormat:@"view id: '%lld'", viewId]]);
204204
}
205205

206206
NSObject<FlutterPlatformViewFactory>* factory = factories_[viewType].get();
@@ -234,7 +234,8 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
234234
arguments:params];
235235
UIView* platform_view = [embedded_view view];
236236
// Set a unique view identifier, so the platform view can be identified in unit tests.
237-
platform_view.accessibilityIdentifier = [NSString stringWithFormat:@"platform_view[%ld]", viewId];
237+
platform_view.accessibilityIdentifier =
238+
[NSString stringWithFormat:@"platform_view[%lld]", viewId];
238239
views_[viewId] = fml::scoped_nsobject<NSObject<FlutterPlatformView>>([embedded_view retain]);
239240

240241
FlutterTouchInterceptingView* touch_interceptor = [[[FlutterTouchInterceptingView alloc]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ - (void)handleMethodCall:(nonnull FlutterMethodCall*)call result:(nonnull Flutte
9090
if ([[call method] isEqualToString:@"create"]) {
9191
NSMutableDictionary<NSString*, id>* args = [call arguments];
9292
if ([args objectForKey:@"id"]) {
93-
int64_t viewId = [args[@"id"] longValue];
93+
int64_t viewId = [args[@"id"] longLongValue];
9494
NSString* viewType = [NSString stringWithUTF8String:([args[@"viewType"] UTF8String])];
9595
[self onCreateWithViewID:viewId viewType:viewType result:result];
9696
} else {
@@ -100,7 +100,7 @@ - (void)handleMethodCall:(nonnull FlutterMethodCall*)call result:(nonnull Flutte
100100
}
101101
} else if ([[call method] isEqualToString:@"dispose"]) {
102102
NSNumber* arg = [call arguments];
103-
int64_t viewId = [arg longValue];
103+
int64_t viewId = [arg longLongValue];
104104
[self onDisposeWithViewID:viewId result:result];
105105
} else {
106106
result(FlutterMethodNotImplemented);

0 commit comments

Comments
 (0)