From aea22046714149fbff18f78c3d4b5332c571e9a8 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 14 Oct 2020 19:15:25 -0700 Subject: [PATCH 1/4] [video_player_platform_interface] Migrate to null safety --- .../flutter/plugins/videoplayer/Messages.java | 548 +++++++----------- .../video_player/ios/Classes/messages.h | 59 +- .../video_player/ios/Classes/messages.m | 216 +++---- .../CHANGELOG.md | 4 + .../analysis_options.yaml | 4 + .../lib/messages.dart | 461 +++++++-------- .../lib/method_channel_video_player.dart | 4 +- .../lib/video_player_platform_interface.dart | 22 +- .../pubspec.yaml | 11 +- .../method_channel_video_player_test.dart | 4 + script/incremental_build.sh | 1 + 11 files changed, 601 insertions(+), 733 deletions(-) create mode 100644 packages/video_player/video_player_platform_interface/analysis_options.yaml diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java b/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java index 78da7150edf0..f9cf759bdff7 100644 --- a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java +++ b/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.7), do not edit directly. +// Autogenerated from Pigeon (v0.1.12), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.videoplayer; @@ -6,6 +6,7 @@ import io.flutter.plugin.common.BasicMessageChannel; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.StandardMessageCodec; +import java.util.ArrayList; import java.util.HashMap; /** Generated class from Pigeon. */ @@ -15,28 +16,18 @@ public class Messages { /** Generated class from Pigeon that represents data sent in messages. */ public static class TextureMessage { private Long textureId; - - public Long getTextureId() { - return textureId; - } - - public void setTextureId(Long setterArg) { - this.textureId = setterArg; - } + public Long getTextureId() { return textureId; } + public void setTextureId(Long setterArg) { this.textureId = setterArg; } HashMap toMap() { HashMap toMapResult = new HashMap<>(); toMapResult.put("textureId", textureId); return toMapResult; } - static TextureMessage fromMap(HashMap map) { TextureMessage fromMapResult = new TextureMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = - (textureId == null) - ? null - : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); + fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); return fromMapResult; } } @@ -44,44 +35,20 @@ static TextureMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class CreateMessage { private String asset; - - public String getAsset() { - return asset; - } - - public void setAsset(String setterArg) { - this.asset = setterArg; - } + public String getAsset() { return asset; } + public void setAsset(String setterArg) { this.asset = setterArg; } private String uri; - - public String getUri() { - return uri; - } - - public void setUri(String setterArg) { - this.uri = setterArg; - } + public String getUri() { return uri; } + public void setUri(String setterArg) { this.uri = setterArg; } private String packageName; - - public String getPackageName() { - return packageName; - } - - public void setPackageName(String setterArg) { - this.packageName = setterArg; - } + public String getPackageName() { return packageName; } + public void setPackageName(String setterArg) { this.packageName = setterArg; } private String formatHint; - - public String getFormatHint() { - return formatHint; - } - - public void setFormatHint(String setterArg) { - this.formatHint = setterArg; - } + public String getFormatHint() { return formatHint; } + public void setFormatHint(String setterArg) { this.formatHint = setterArg; } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -91,17 +58,16 @@ HashMap toMap() { toMapResult.put("formatHint", formatHint); return toMapResult; } - static CreateMessage fromMap(HashMap map) { CreateMessage fromMapResult = new CreateMessage(); Object asset = map.get("asset"); - fromMapResult.asset = (String) asset; + fromMapResult.asset = (String)asset; Object uri = map.get("uri"); - fromMapResult.uri = (String) uri; + fromMapResult.uri = (String)uri; Object packageName = map.get("packageName"); - fromMapResult.packageName = (String) packageName; + fromMapResult.packageName = (String)packageName; Object formatHint = map.get("formatHint"); - fromMapResult.formatHint = (String) formatHint; + fromMapResult.formatHint = (String)formatHint; return fromMapResult; } } @@ -109,24 +75,12 @@ static CreateMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class LoopingMessage { private Long textureId; - - public Long getTextureId() { - return textureId; - } - - public void setTextureId(Long setterArg) { - this.textureId = setterArg; - } + public Long getTextureId() { return textureId; } + public void setTextureId(Long setterArg) { this.textureId = setterArg; } private Boolean isLooping; - - public Boolean getIsLooping() { - return isLooping; - } - - public void setIsLooping(Boolean setterArg) { - this.isLooping = setterArg; - } + public Boolean getIsLooping() { return isLooping; } + public void setIsLooping(Boolean setterArg) { this.isLooping = setterArg; } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -134,16 +88,12 @@ HashMap toMap() { toMapResult.put("isLooping", isLooping); return toMapResult; } - static LoopingMessage fromMap(HashMap map) { LoopingMessage fromMapResult = new LoopingMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = - (textureId == null) - ? null - : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); + fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); Object isLooping = map.get("isLooping"); - fromMapResult.isLooping = (Boolean) isLooping; + fromMapResult.isLooping = (Boolean)isLooping; return fromMapResult; } } @@ -151,24 +101,12 @@ static LoopingMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class VolumeMessage { private Long textureId; - - public Long getTextureId() { - return textureId; - } - - public void setTextureId(Long setterArg) { - this.textureId = setterArg; - } + public Long getTextureId() { return textureId; } + public void setTextureId(Long setterArg) { this.textureId = setterArg; } private Double volume; - - public Double getVolume() { - return volume; - } - - public void setVolume(Double setterArg) { - this.volume = setterArg; - } + public Double getVolume() { return volume; } + public void setVolume(Double setterArg) { this.volume = setterArg; } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -176,16 +114,12 @@ HashMap toMap() { toMapResult.put("volume", volume); return toMapResult; } - static VolumeMessage fromMap(HashMap map) { VolumeMessage fromMapResult = new VolumeMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = - (textureId == null) - ? null - : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); + fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); Object volume = map.get("volume"); - fromMapResult.volume = (Double) volume; + fromMapResult.volume = (Double)volume; return fromMapResult; } } @@ -193,24 +127,12 @@ static VolumeMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class PlaybackSpeedMessage { private Long textureId; - - public Long getTextureId() { - return textureId; - } - - public void setTextureId(Long setterArg) { - this.textureId = setterArg; - } + public Long getTextureId() { return textureId; } + public void setTextureId(Long setterArg) { this.textureId = setterArg; } private Double speed; - - public Double getSpeed() { - return speed; - } - - public void setSpeed(Double setterArg) { - this.speed = setterArg; - } + public Double getSpeed() { return speed; } + public void setSpeed(Double setterArg) { this.speed = setterArg; } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -218,16 +140,12 @@ HashMap toMap() { toMapResult.put("speed", speed); return toMapResult; } - static PlaybackSpeedMessage fromMap(HashMap map) { PlaybackSpeedMessage fromMapResult = new PlaybackSpeedMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = - (textureId == null) - ? null - : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); + fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); Object speed = map.get("speed"); - fromMapResult.speed = (Double) speed; + fromMapResult.speed = (Double)speed; return fromMapResult; } } @@ -235,24 +153,12 @@ static PlaybackSpeedMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class PositionMessage { private Long textureId; - - public Long getTextureId() { - return textureId; - } - - public void setTextureId(Long setterArg) { - this.textureId = setterArg; - } + public Long getTextureId() { return textureId; } + public void setTextureId(Long setterArg) { this.textureId = setterArg; } private Long position; - - public Long getPosition() { - return position; - } - - public void setPosition(Long setterArg) { - this.position = setterArg; - } + public Long getPosition() { return position; } + public void setPosition(Long setterArg) { this.position = setterArg; } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -260,19 +166,12 @@ HashMap toMap() { toMapResult.put("position", position); return toMapResult; } - static PositionMessage fromMap(HashMap map) { PositionMessage fromMapResult = new PositionMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = - (textureId == null) - ? null - : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); + fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); Object position = map.get("position"); - fromMapResult.position = - (position == null) - ? null - : ((position instanceof Integer) ? (Integer) position : (Long) position); + fromMapResult.position = (position == null) ? null : ((position instanceof Integer) ? (Integer)position : (Long)position); return fromMapResult; } } @@ -280,324 +179,273 @@ static PositionMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class MixWithOthersMessage { private Boolean mixWithOthers; - - public Boolean getMixWithOthers() { - return mixWithOthers; - } - - public void setMixWithOthers(Boolean setterArg) { - this.mixWithOthers = setterArg; - } + public Boolean getMixWithOthers() { return mixWithOthers; } + public void setMixWithOthers(Boolean setterArg) { this.mixWithOthers = setterArg; } HashMap toMap() { HashMap toMapResult = new HashMap<>(); toMapResult.put("mixWithOthers", mixWithOthers); return toMapResult; } - static MixWithOthersMessage fromMap(HashMap map) { MixWithOthersMessage fromMapResult = new MixWithOthersMessage(); Object mixWithOthers = map.get("mixWithOthers"); - fromMapResult.mixWithOthers = (Boolean) mixWithOthers; + fromMapResult.mixWithOthers = (Boolean)mixWithOthers; return fromMapResult; } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ + /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/ public interface VideoPlayerApi { void initialize(); - TextureMessage create(CreateMessage arg); - void dispose(TextureMessage arg); - void setLooping(LoopingMessage arg); - void setVolume(VolumeMessage arg); - void setPlaybackSpeed(PlaybackSpeedMessage arg); - void play(TextureMessage arg); - PositionMessage position(TextureMessage arg); - void seekTo(PositionMessage arg); - void pause(TextureMessage arg); - void setMixWithOthers(MixWithOthersMessage arg); /** Sets up an instance of `VideoPlayerApi` to handle messages through the `binaryMessenger` */ static void setup(BinaryMessenger binaryMessenger, VideoPlayerApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.initialize", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.initialize", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - api.initialize(); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + api.initialize(); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.create", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.create", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - CreateMessage input = CreateMessage.fromMap((HashMap) message); - TextureMessage output = api.create(input); - wrapped.put("result", output.toMap()); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + CreateMessage input = CreateMessage.fromMap((HashMap)message); + TextureMessage output = api.create(input); + wrapped.put("result", output.toMap()); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.dispose", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.dispose", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - TextureMessage input = TextureMessage.fromMap((HashMap) message); - api.dispose(input); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + TextureMessage input = TextureMessage.fromMap((HashMap)message); + api.dispose(input); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.setLooping", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setLooping", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - LoopingMessage input = LoopingMessage.fromMap((HashMap) message); - api.setLooping(input); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + LoopingMessage input = LoopingMessage.fromMap((HashMap)message); + api.setLooping(input); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.setVolume", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setVolume", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - VolumeMessage input = VolumeMessage.fromMap((HashMap) message); - api.setVolume(input); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + VolumeMessage input = VolumeMessage.fromMap((HashMap)message); + api.setVolume(input); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - PlaybackSpeedMessage input = PlaybackSpeedMessage.fromMap((HashMap) message); - api.setPlaybackSpeed(input); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + PlaybackSpeedMessage input = PlaybackSpeedMessage.fromMap((HashMap)message); + api.setPlaybackSpeed(input); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.play", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.play", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - TextureMessage input = TextureMessage.fromMap((HashMap) message); - api.play(input); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + TextureMessage input = TextureMessage.fromMap((HashMap)message); + api.play(input); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.position", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.position", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - TextureMessage input = TextureMessage.fromMap((HashMap) message); - PositionMessage output = api.position(input); - wrapped.put("result", output.toMap()); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + TextureMessage input = TextureMessage.fromMap((HashMap)message); + PositionMessage output = api.position(input); + wrapped.put("result", output.toMap()); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.seekTo", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.seekTo", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - PositionMessage input = PositionMessage.fromMap((HashMap) message); - api.seekTo(input); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + PositionMessage input = PositionMessage.fromMap((HashMap)message); + api.seekTo(input); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.pause", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.pause", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - TextureMessage input = TextureMessage.fromMap((HashMap) message); - api.pause(input); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + TextureMessage input = TextureMessage.fromMap((HashMap)message); + api.pause(input); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers", - new StandardMessageCodec()); + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers", new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - MixWithOthersMessage input = MixWithOthersMessage.fromMap((HashMap) message); - api.setMixWithOthers(input); - wrapped.put("result", null); - } catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler((message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + MixWithOthersMessage input = MixWithOthersMessage.fromMap((HashMap)message); + api.setMixWithOthers(input); + wrapped.put("result", null); + } + catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } - private static HashMap wrapError(Exception exception) { HashMap errorMap = new HashMap<>(); errorMap.put("message", exception.toString()); - errorMap.put("code", null); + errorMap.put("code", exception.getClass().getSimpleName()); errorMap.put("details", null); return errorMap; } diff --git a/packages/video_player/video_player/ios/Classes/messages.h b/packages/video_player/video_player/ios/Classes/messages.h index 3c68b3dd24d4..0cde937cd0c8 100644 --- a/packages/video_player/video_player/ios/Classes/messages.h +++ b/packages/video_player/video_player/ios/Classes/messages.h @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.7), do not edit directly. +// Autogenerated from Pigeon (v0.1.12), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @protocol FlutterBinaryMessenger; @@ -16,59 +16,54 @@ NS_ASSUME_NONNULL_BEGIN @class FLTMixWithOthersMessage; @interface FLTTextureMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber *textureId; +@property(nonatomic, strong, nullable) NSNumber * textureId; @end @interface FLTCreateMessage : NSObject -@property(nonatomic, copy, nullable) NSString *asset; -@property(nonatomic, copy, nullable) NSString *uri; -@property(nonatomic, copy, nullable) NSString *packageName; -@property(nonatomic, copy, nullable) NSString *formatHint; +@property(nonatomic, copy, nullable) NSString * asset; +@property(nonatomic, copy, nullable) NSString * uri; +@property(nonatomic, copy, nullable) NSString * packageName; +@property(nonatomic, copy, nullable) NSString * formatHint; @end @interface FLTLoopingMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber *textureId; -@property(nonatomic, strong, nullable) NSNumber *isLooping; +@property(nonatomic, strong, nullable) NSNumber * textureId; +@property(nonatomic, strong, nullable) NSNumber * isLooping; @end @interface FLTVolumeMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber *textureId; -@property(nonatomic, strong, nullable) NSNumber *volume; +@property(nonatomic, strong, nullable) NSNumber * textureId; +@property(nonatomic, strong, nullable) NSNumber * volume; @end @interface FLTPlaybackSpeedMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber *textureId; -@property(nonatomic, strong, nullable) NSNumber *speed; +@property(nonatomic, strong, nullable) NSNumber * textureId; +@property(nonatomic, strong, nullable) NSNumber * speed; @end @interface FLTPositionMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber *textureId; -@property(nonatomic, strong, nullable) NSNumber *position; +@property(nonatomic, strong, nullable) NSNumber * textureId; +@property(nonatomic, strong, nullable) NSNumber * position; @end @interface FLTMixWithOthersMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber *mixWithOthers; +@property(nonatomic, strong, nullable) NSNumber * mixWithOthers; @end @protocol FLTVideoPlayerApi -- (void)initialize:(FlutterError *_Nullable *_Nonnull)error; -- (nullable FLTTextureMessage *)create:(FLTCreateMessage *)input - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)dispose:(FLTTextureMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setLooping:(FLTLoopingMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setVolume:(FLTVolumeMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setPlaybackSpeed:(FLTPlaybackSpeedMessage *)input - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)play:(FLTTextureMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable FLTPositionMessage *)position:(FLTTextureMessage *)input - error:(FlutterError *_Nullable *_Nonnull)error; -- (void)seekTo:(FLTPositionMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; -- (void)pause:(FLTTextureMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setMixWithOthers:(FLTMixWithOthersMessage *)input - error:(FlutterError *_Nullable *_Nonnull)error; +-(void)initialize:(FlutterError *_Nullable *_Nonnull)error; +-(nullable FLTTextureMessage *)create:(FLTCreateMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(void)dispose:(FLTTextureMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(void)setLooping:(FLTLoopingMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(void)setVolume:(FLTVolumeMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(void)setPlaybackSpeed:(FLTPlaybackSpeedMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(void)play:(FLTTextureMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(nullable FLTPositionMessage *)position:(FLTTextureMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(void)seekTo:(FLTPositionMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(void)pause:(FLTTextureMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +-(void)setMixWithOthers:(FLTMixWithOthersMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FLTVideoPlayerApiSetup(id binaryMessenger, - id _Nullable api); +extern void FLTVideoPlayerApiSetup(id binaryMessenger, id _Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/video_player/video_player/ios/Classes/messages.m b/packages/video_player/video_player/ios/Classes/messages.m index e71f8b89254d..a6d3f257f20a 100644 --- a/packages/video_player/video_player/ios/Classes/messages.m +++ b/packages/video_player/video_player/ios/Classes/messages.m @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.7), do not edit directly. +// Autogenerated from Pigeon (v0.1.12), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "messages.h" #import @@ -7,67 +7,67 @@ #error File requires ARC to be enabled. #endif -static NSDictionary *wrapResult(NSDictionary *result, FlutterError *error) { +static NSDictionary* wrapResult(NSDictionary *result, FlutterError *error) { NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { - errorDict = [NSDictionary - dictionaryWithObjectsAndKeys:(error.code ? error.code : [NSNull null]), @"code", - (error.message ? error.message : [NSNull null]), @"message", - (error.details ? error.details : [NSNull null]), @"details", - nil]; + errorDict = [NSDictionary dictionaryWithObjectsAndKeys: + (error.code ? error.code : [NSNull null]), @"code", + (error.message ? error.message : [NSNull null]), @"message", + (error.details ? error.details : [NSNull null]), @"details", + nil]; } - return [NSDictionary dictionaryWithObjectsAndKeys:(result ? result : [NSNull null]), @"result", - errorDict, @"error", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys: + (result ? result : [NSNull null]), @"result", + errorDict, @"error", + nil]; } @interface FLTTextureMessage () -+ (FLTTextureMessage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++(FLTTextureMessage*)fromMap:(NSDictionary*)dict; +-(NSDictionary*)toMap; @end @interface FLTCreateMessage () -+ (FLTCreateMessage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++(FLTCreateMessage*)fromMap:(NSDictionary*)dict; +-(NSDictionary*)toMap; @end @interface FLTLoopingMessage () -+ (FLTLoopingMessage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++(FLTLoopingMessage*)fromMap:(NSDictionary*)dict; +-(NSDictionary*)toMap; @end @interface FLTVolumeMessage () -+ (FLTVolumeMessage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++(FLTVolumeMessage*)fromMap:(NSDictionary*)dict; +-(NSDictionary*)toMap; @end @interface FLTPlaybackSpeedMessage () -+ (FLTPlaybackSpeedMessage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++(FLTPlaybackSpeedMessage*)fromMap:(NSDictionary*)dict; +-(NSDictionary*)toMap; @end @interface FLTPositionMessage () -+ (FLTPositionMessage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++(FLTPositionMessage*)fromMap:(NSDictionary*)dict; +-(NSDictionary*)toMap; @end @interface FLTMixWithOthersMessage () -+ (FLTMixWithOthersMessage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++(FLTMixWithOthersMessage*)fromMap:(NSDictionary*)dict; +-(NSDictionary*)toMap; @end @implementation FLTTextureMessage -+ (FLTTextureMessage *)fromMap:(NSDictionary *)dict { - FLTTextureMessage *result = [[FLTTextureMessage alloc] init]; ++(FLTTextureMessage*)fromMap:(NSDictionary*)dict { + FLTTextureMessage* result = [[FLTTextureMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; } return result; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", nil]; +-(NSDictionary*)toMap { + return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", nil]; } @end @implementation FLTCreateMessage -+ (FLTCreateMessage *)fromMap:(NSDictionary *)dict { - FLTCreateMessage *result = [[FLTCreateMessage alloc] init]; ++(FLTCreateMessage*)fromMap:(NSDictionary*)dict { + FLTCreateMessage* result = [[FLTCreateMessage alloc] init]; result.asset = dict[@"asset"]; if ((NSNull *)result.asset == [NSNull null]) { result.asset = nil; @@ -86,20 +86,14 @@ + (FLTCreateMessage *)fromMap:(NSDictionary *)dict { } return result; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.asset ? self.asset : [NSNull null]), @"asset", - (self.uri ? self.uri : [NSNull null]), @"uri", - (self.packageName ? self.packageName : [NSNull null]), - @"packageName", - (self.formatHint ? self.formatHint : [NSNull null]), - @"formatHint", nil]; +-(NSDictionary*)toMap { + return [NSDictionary dictionaryWithObjectsAndKeys:(self.asset ? self.asset : [NSNull null]), @"asset", (self.uri ? self.uri : [NSNull null]), @"uri", (self.packageName ? self.packageName : [NSNull null]), @"packageName", (self.formatHint ? self.formatHint : [NSNull null]), @"formatHint", nil]; } @end @implementation FLTLoopingMessage -+ (FLTLoopingMessage *)fromMap:(NSDictionary *)dict { - FLTLoopingMessage *result = [[FLTLoopingMessage alloc] init]; ++(FLTLoopingMessage*)fromMap:(NSDictionary*)dict { + FLTLoopingMessage* result = [[FLTLoopingMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; @@ -110,18 +104,14 @@ + (FLTLoopingMessage *)fromMap:(NSDictionary *)dict { } return result; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", - (self.isLooping != nil ? self.isLooping : [NSNull null]), - @"isLooping", nil]; +-(NSDictionary*)toMap { + return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", (self.isLooping ? self.isLooping : [NSNull null]), @"isLooping", nil]; } @end @implementation FLTVolumeMessage -+ (FLTVolumeMessage *)fromMap:(NSDictionary *)dict { - FLTVolumeMessage *result = [[FLTVolumeMessage alloc] init]; ++(FLTVolumeMessage*)fromMap:(NSDictionary*)dict { + FLTVolumeMessage* result = [[FLTVolumeMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; @@ -132,17 +122,14 @@ + (FLTVolumeMessage *)fromMap:(NSDictionary *)dict { } return result; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", (self.volume != nil ? self.volume : [NSNull null]), - @"volume", nil]; +-(NSDictionary*)toMap { + return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", (self.volume ? self.volume : [NSNull null]), @"volume", nil]; } @end @implementation FLTPlaybackSpeedMessage -+ (FLTPlaybackSpeedMessage *)fromMap:(NSDictionary *)dict { - FLTPlaybackSpeedMessage *result = [[FLTPlaybackSpeedMessage alloc] init]; ++(FLTPlaybackSpeedMessage*)fromMap:(NSDictionary*)dict { + FLTPlaybackSpeedMessage* result = [[FLTPlaybackSpeedMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; @@ -153,17 +140,14 @@ + (FLTPlaybackSpeedMessage *)fromMap:(NSDictionary *)dict { } return result; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", (self.speed != nil ? self.speed : [NSNull null]), - @"speed", nil]; +-(NSDictionary*)toMap { + return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", (self.speed ? self.speed : [NSNull null]), @"speed", nil]; } @end @implementation FLTPositionMessage -+ (FLTPositionMessage *)fromMap:(NSDictionary *)dict { - FLTPositionMessage *result = [[FLTPositionMessage alloc] init]; ++(FLTPositionMessage*)fromMap:(NSDictionary*)dict { + FLTPositionMessage* result = [[FLTPositionMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; @@ -174,50 +158,47 @@ + (FLTPositionMessage *)fromMap:(NSDictionary *)dict { } return result; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", - (self.position != nil ? self.position : [NSNull null]), - @"position", nil]; +-(NSDictionary*)toMap { + return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", (self.position ? self.position : [NSNull null]), @"position", nil]; } @end @implementation FLTMixWithOthersMessage -+ (FLTMixWithOthersMessage *)fromMap:(NSDictionary *)dict { - FLTMixWithOthersMessage *result = [[FLTMixWithOthersMessage alloc] init]; ++(FLTMixWithOthersMessage*)fromMap:(NSDictionary*)dict { + FLTMixWithOthersMessage* result = [[FLTMixWithOthersMessage alloc] init]; result.mixWithOthers = dict[@"mixWithOthers"]; if ((NSNull *)result.mixWithOthers == [NSNull null]) { result.mixWithOthers = nil; } return result; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.mixWithOthers != nil ? self.mixWithOthers : [NSNull null]), - @"mixWithOthers", nil]; +-(NSDictionary*)toMap { + return [NSDictionary dictionaryWithObjectsAndKeys:(self.mixWithOthers ? self.mixWithOthers : [NSNull null]), @"mixWithOthers", nil]; } @end void FLTVideoPlayerApiSetup(id binaryMessenger, id api) { { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.VideoPlayerApi.initialize" - binaryMessenger:binaryMessenger]; + binaryMessenger:binaryMessenger]; if (api) { [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api initialize:&error]; callback(wrapResult(nil, error)); }]; - } else { + } + else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + FlutterBasicMessageChannel *channel = + [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.VideoPlayerApi.create" - binaryMessenger:binaryMessenger]; + binaryMessenger:binaryMessenger]; if (api) { [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; @@ -225,14 +206,16 @@ void FLTVideoPlayerApiSetup(id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id _toMap() { final Map pigeonMap = {}; pigeonMap['textureId'] = textureId; return pigeonMap; } - // ignore: unused_element static TextureMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final TextureMessage result = TextureMessage(); result.textureId = pigeonMap['textureId']; return result; @@ -27,10 +23,10 @@ class TextureMessage { } class CreateMessage { - String asset; - String uri; - String packageName; - String formatHint; + String? asset; + String? uri; + String? packageName; + String? formatHint; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -40,12 +36,8 @@ class CreateMessage { pigeonMap['formatHint'] = formatHint; return pigeonMap; } - // ignore: unused_element static CreateMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final CreateMessage result = CreateMessage(); result.asset = pigeonMap['asset']; result.uri = pigeonMap['uri']; @@ -56,8 +48,8 @@ class CreateMessage { } class LoopingMessage { - int textureId; - bool isLooping; + int? textureId; + bool? isLooping; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -65,12 +57,8 @@ class LoopingMessage { pigeonMap['isLooping'] = isLooping; return pigeonMap; } - // ignore: unused_element static LoopingMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final LoopingMessage result = LoopingMessage(); result.textureId = pigeonMap['textureId']; result.isLooping = pigeonMap['isLooping']; @@ -79,8 +67,8 @@ class LoopingMessage { } class VolumeMessage { - int textureId; - double volume; + int? textureId; + double? volume; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -88,12 +76,8 @@ class VolumeMessage { pigeonMap['volume'] = volume; return pigeonMap; } - // ignore: unused_element static VolumeMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final VolumeMessage result = VolumeMessage(); result.textureId = pigeonMap['textureId']; result.volume = pigeonMap['volume']; @@ -102,8 +86,8 @@ class VolumeMessage { } class PlaybackSpeedMessage { - int textureId; - double speed; + int? textureId; + double? speed; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -111,12 +95,8 @@ class PlaybackSpeedMessage { pigeonMap['speed'] = speed; return pigeonMap; } - // ignore: unused_element static PlaybackSpeedMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final PlaybackSpeedMessage result = PlaybackSpeedMessage(); result.textureId = pigeonMap['textureId']; result.speed = pigeonMap['speed']; @@ -125,8 +105,8 @@ class PlaybackSpeedMessage { } class PositionMessage { - int textureId; - int position; + int? textureId; + int? position; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -134,12 +114,8 @@ class PositionMessage { pigeonMap['position'] = position; return pigeonMap; } - // ignore: unused_element static PositionMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final PositionMessage result = PositionMessage(); result.textureId = pigeonMap['textureId']; result.position = pigeonMap['position']; @@ -148,19 +124,15 @@ class PositionMessage { } class MixWithOthersMessage { - bool mixWithOthers; + bool? mixWithOthers; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; pigeonMap['mixWithOthers'] = mixWithOthers; return pigeonMap; } - // ignore: unused_element static MixWithOthersMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final MixWithOthersMessage result = MixWithOthersMessage(); result.mixWithOthers = pigeonMap['mixWithOthers']; return result; @@ -169,15 +141,15 @@ class MixWithOthersMessage { class VideoPlayerApi { Future initialize() async { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); - final Map replyMap = await channel.send(null); + final Map? replyMap = await channel.send(null); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -187,19 +159,19 @@ class VideoPlayerApi { } else { // noop } - } + } Future create(CreateMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -209,19 +181,19 @@ class VideoPlayerApi { } else { return TextureMessage._fromMap(replyMap['result']); } - } + } Future dispose(TextureMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -231,19 +203,19 @@ class VideoPlayerApi { } else { // noop } - } + } Future setLooping(LoopingMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -253,19 +225,19 @@ class VideoPlayerApi { } else { // noop } - } + } Future setVolume(VolumeMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -275,20 +247,19 @@ class VideoPlayerApi { } else { // noop } - } + } Future setPlaybackSpeed(PlaybackSpeedMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', - StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -298,19 +269,19 @@ class VideoPlayerApi { } else { // noop } - } + } Future play(TextureMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -320,19 +291,19 @@ class VideoPlayerApi { } else { // noop } - } + } Future position(TextureMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -342,19 +313,19 @@ class VideoPlayerApi { } else { return PositionMessage._fromMap(replyMap['result']); } - } + } Future seekTo(PositionMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -364,19 +335,19 @@ class VideoPlayerApi { } else { // noop } - } + } Future pause(TextureMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -386,20 +357,19 @@ class VideoPlayerApi { } else { // noop } - } + } Future setMixWithOthers(MixWithOthersMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', - StandardMessageCodec()); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -409,6 +379,7 @@ class VideoPlayerApi { } else { // noop } + } } @@ -424,131 +395,169 @@ abstract class TestHostVideoPlayerApi { void seekTo(PositionMessage arg); void pause(TextureMessage arg); void setMixWithOthers(MixWithOthersMessage arg); - static void setup(TestHostVideoPlayerApi api) { + static void setup(TestHostVideoPlayerApi? api) { { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.initialize', - StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - api.initialize(); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + api.initialize(); + return {}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final CreateMessage input = CreateMessage._fromMap(mapMessage); - final TextureMessage output = api.create(input); - return {'result': output._toMap()}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final CreateMessage input = CreateMessage._fromMap(mapMessage); + final TextureMessage output = api.create(input); + return {'result': output._toMap()}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final TextureMessage input = TextureMessage._fromMap(mapMessage); - api.dispose(input); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final TextureMessage input = TextureMessage._fromMap(mapMessage); + api.dispose(input); + return {}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.setLooping', - StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final LoopingMessage input = LoopingMessage._fromMap(mapMessage); - api.setLooping(input); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final LoopingMessage input = LoopingMessage._fromMap(mapMessage); + api.setLooping(input); + return {}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.setVolume', - StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final VolumeMessage input = VolumeMessage._fromMap(mapMessage); - api.setVolume(input); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final VolumeMessage input = VolumeMessage._fromMap(mapMessage); + api.setVolume(input); + return {}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', - StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final PlaybackSpeedMessage input = - PlaybackSpeedMessage._fromMap(mapMessage); - api.setPlaybackSpeed(input); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final PlaybackSpeedMessage input = PlaybackSpeedMessage._fromMap(mapMessage); + api.setPlaybackSpeed(input); + return {}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final TextureMessage input = TextureMessage._fromMap(mapMessage); - api.play(input); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final TextureMessage input = TextureMessage._fromMap(mapMessage); + api.play(input); + return {}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final TextureMessage input = TextureMessage._fromMap(mapMessage); - final PositionMessage output = api.position(input); - return {'result': output._toMap()}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final TextureMessage input = TextureMessage._fromMap(mapMessage); + final PositionMessage output = api.position(input); + return {'result': output._toMap()}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final PositionMessage input = PositionMessage._fromMap(mapMessage); - api.seekTo(input); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final PositionMessage input = PositionMessage._fromMap(mapMessage); + api.seekTo(input); + return {}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final TextureMessage input = TextureMessage._fromMap(mapMessage); - api.pause(input); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final TextureMessage input = TextureMessage._fromMap(mapMessage); + api.pause(input); + return {}; + }); + } } { - const BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', - StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final MixWithOthersMessage input = - MixWithOthersMessage._fromMap(mapMessage); - api.setMixWithOthers(input); - return {}; - }); + const BasicMessageChannel channel = + BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', StandardMessageCodec()); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = message as Map; + final MixWithOthersMessage input = MixWithOthersMessage._fromMap(mapMessage); + api.setMixWithOthers(input); + return {}; + }); + } } } } diff --git a/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart b/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart index 0ea443fb6e12..9b007d00d6a9 100644 --- a/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart +++ b/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart @@ -26,7 +26,7 @@ class MethodChannelVideoPlayer extends VideoPlayerPlatform { } @override - Future create(DataSource dataSource) async { + Future create(DataSource dataSource) async { CreateMessage message = CreateMessage(); switch (dataSource.sourceType) { @@ -91,7 +91,7 @@ class MethodChannelVideoPlayer extends VideoPlayerPlatform { Future getPosition(int textureId) async { PositionMessage response = await _api.position(TextureMessage()..textureId = textureId); - return Duration(milliseconds: response.position); + return Duration(milliseconds: response.position!); } @override diff --git a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart index 2757fb135af6..7b472dc8d442 100644 --- a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart +++ b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart @@ -7,7 +7,7 @@ import 'dart:ui'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; -import 'package:meta/meta.dart' show required, visibleForTesting; +import 'package:meta/meta.dart' show visibleForTesting; import 'method_channel_video_player.dart'; @@ -66,7 +66,7 @@ abstract class VideoPlayerPlatform { } /// Creates an instance of a video player and returns its textureId. - Future create(DataSource dataSource) { + Future create(DataSource dataSource) { throw UnimplementedError('create() has not been implemented.'); } @@ -146,8 +146,8 @@ class DataSource { /// The [package] argument must be non-null when the asset comes from a /// package and null otherwise. DataSource({ - @required this.sourceType, - this.uri, + required this.sourceType, + required this.uri, this.formatHint, this.asset, this.package, @@ -167,14 +167,14 @@ class DataSource { /// **Android only**. Will override the platform's generic file format /// detection with whatever is set here. - final VideoFormat formatHint; + final VideoFormat? formatHint; /// The name of the asset. Only set for [DataSourceType.asset] videos. - final String asset; + final String? asset; /// The package that the asset was loaded from. Only set for /// [DataSourceType.asset] videos. - final String package; + final String? package; } /// The way in which the video was originally loaded. @@ -216,7 +216,7 @@ class VideoEvent { /// Depending on the [eventType], the [duration], [size] and [buffered] /// arguments can be null. VideoEvent({ - @required this.eventType, + required this.eventType, this.duration, this.size, this.buffered, @@ -228,17 +228,17 @@ class VideoEvent { /// Duration of the video. /// /// Only used if [eventType] is [VideoEventType.initialized]. - final Duration duration; + final Duration? duration; /// Size of the video. /// /// Only used if [eventType] is [VideoEventType.initialized]. - final Size size; + final Size? size; /// Buffered parts of the video. /// /// Only used if [eventType] is [VideoEventType.bufferingUpdate]. - final List buffered; + final List? buffered; @override bool operator ==(Object other) { diff --git a/packages/video_player/video_player_platform_interface/pubspec.yaml b/packages/video_player/video_player_platform_interface/pubspec.yaml index cc3cd79f1f33..d86a3b9132e3 100644 --- a/packages/video_player/video_player_platform_interface/pubspec.yaml +++ b/packages/video_player/video_player_platform_interface/pubspec.yaml @@ -3,19 +3,22 @@ description: A common platform interface for the video_player plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_platform_interface # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.2.0 +version: 3.0.0-nullsafety dependencies: flutter: sdk: flutter - meta: ^1.0.5 + meta: ^1.3.0-nullsafety.3 dev_dependencies: flutter_test: sdk: flutter mockito: ^4.1.1 - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.1 + +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none environment: - sdk: ">=2.8.0 <3.0.0" + sdk: ">=2.10.0-56.0.dev <3.0.0" flutter: ">=1.10.0 <2.0.0" diff --git a/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart b/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart index c4791001ad92..4db58770c629 100644 --- a/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart +++ b/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// TODO(egarciad): Remove once Mockito is migrated to null safety. +// @dart = 2.9 + import 'dart:ui'; import 'package:flutter/services.dart'; @@ -142,6 +145,7 @@ void main() { test('create with asset', () async { final int textureId = await player.create(DataSource( sourceType: DataSourceType.asset, + uri: 'someUri', asset: 'someAsset', package: 'somePackage', )); diff --git a/script/incremental_build.sh b/script/incremental_build.sh index c65d1d11eadc..771242acd4e7 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -23,6 +23,7 @@ CUSTOM_ANALYSIS_PLUGINS=( "in_app_purchase" "camera" "plugin_platform_interface" + "video_player/video_player_platform_interface" "video_player/video_player_web" "google_maps_flutter/google_maps_flutter_web" ) From f32d2ea1670b1974ae76c18209f087aba945651e Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Thu, 15 Oct 2020 10:54:32 -0700 Subject: [PATCH 2/4] Format --- .../flutter/plugins/videoplayer/Messages.java | 544 +++++++++++------- .../lib/messages.dart | 236 ++++---- 2 files changed, 473 insertions(+), 307 deletions(-) diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java b/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java index f9cf759bdff7..98cf6dbaacea 100644 --- a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java +++ b/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java @@ -6,7 +6,6 @@ import io.flutter.plugin.common.BasicMessageChannel; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.StandardMessageCodec; -import java.util.ArrayList; import java.util.HashMap; /** Generated class from Pigeon. */ @@ -16,18 +15,28 @@ public class Messages { /** Generated class from Pigeon that represents data sent in messages. */ public static class TextureMessage { private Long textureId; - public Long getTextureId() { return textureId; } - public void setTextureId(Long setterArg) { this.textureId = setterArg; } + + public Long getTextureId() { + return textureId; + } + + public void setTextureId(Long setterArg) { + this.textureId = setterArg; + } HashMap toMap() { HashMap toMapResult = new HashMap<>(); toMapResult.put("textureId", textureId); return toMapResult; } + static TextureMessage fromMap(HashMap map) { TextureMessage fromMapResult = new TextureMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); + fromMapResult.textureId = + (textureId == null) + ? null + : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); return fromMapResult; } } @@ -35,20 +44,44 @@ static TextureMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class CreateMessage { private String asset; - public String getAsset() { return asset; } - public void setAsset(String setterArg) { this.asset = setterArg; } + + public String getAsset() { + return asset; + } + + public void setAsset(String setterArg) { + this.asset = setterArg; + } private String uri; - public String getUri() { return uri; } - public void setUri(String setterArg) { this.uri = setterArg; } + + public String getUri() { + return uri; + } + + public void setUri(String setterArg) { + this.uri = setterArg; + } private String packageName; - public String getPackageName() { return packageName; } - public void setPackageName(String setterArg) { this.packageName = setterArg; } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String setterArg) { + this.packageName = setterArg; + } private String formatHint; - public String getFormatHint() { return formatHint; } - public void setFormatHint(String setterArg) { this.formatHint = setterArg; } + + public String getFormatHint() { + return formatHint; + } + + public void setFormatHint(String setterArg) { + this.formatHint = setterArg; + } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -58,16 +91,17 @@ HashMap toMap() { toMapResult.put("formatHint", formatHint); return toMapResult; } + static CreateMessage fromMap(HashMap map) { CreateMessage fromMapResult = new CreateMessage(); Object asset = map.get("asset"); - fromMapResult.asset = (String)asset; + fromMapResult.asset = (String) asset; Object uri = map.get("uri"); - fromMapResult.uri = (String)uri; + fromMapResult.uri = (String) uri; Object packageName = map.get("packageName"); - fromMapResult.packageName = (String)packageName; + fromMapResult.packageName = (String) packageName; Object formatHint = map.get("formatHint"); - fromMapResult.formatHint = (String)formatHint; + fromMapResult.formatHint = (String) formatHint; return fromMapResult; } } @@ -75,12 +109,24 @@ static CreateMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class LoopingMessage { private Long textureId; - public Long getTextureId() { return textureId; } - public void setTextureId(Long setterArg) { this.textureId = setterArg; } + + public Long getTextureId() { + return textureId; + } + + public void setTextureId(Long setterArg) { + this.textureId = setterArg; + } private Boolean isLooping; - public Boolean getIsLooping() { return isLooping; } - public void setIsLooping(Boolean setterArg) { this.isLooping = setterArg; } + + public Boolean getIsLooping() { + return isLooping; + } + + public void setIsLooping(Boolean setterArg) { + this.isLooping = setterArg; + } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -88,12 +134,16 @@ HashMap toMap() { toMapResult.put("isLooping", isLooping); return toMapResult; } + static LoopingMessage fromMap(HashMap map) { LoopingMessage fromMapResult = new LoopingMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); + fromMapResult.textureId = + (textureId == null) + ? null + : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); Object isLooping = map.get("isLooping"); - fromMapResult.isLooping = (Boolean)isLooping; + fromMapResult.isLooping = (Boolean) isLooping; return fromMapResult; } } @@ -101,12 +151,24 @@ static LoopingMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class VolumeMessage { private Long textureId; - public Long getTextureId() { return textureId; } - public void setTextureId(Long setterArg) { this.textureId = setterArg; } + + public Long getTextureId() { + return textureId; + } + + public void setTextureId(Long setterArg) { + this.textureId = setterArg; + } private Double volume; - public Double getVolume() { return volume; } - public void setVolume(Double setterArg) { this.volume = setterArg; } + + public Double getVolume() { + return volume; + } + + public void setVolume(Double setterArg) { + this.volume = setterArg; + } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -114,12 +176,16 @@ HashMap toMap() { toMapResult.put("volume", volume); return toMapResult; } + static VolumeMessage fromMap(HashMap map) { VolumeMessage fromMapResult = new VolumeMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); + fromMapResult.textureId = + (textureId == null) + ? null + : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); Object volume = map.get("volume"); - fromMapResult.volume = (Double)volume; + fromMapResult.volume = (Double) volume; return fromMapResult; } } @@ -127,12 +193,24 @@ static VolumeMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class PlaybackSpeedMessage { private Long textureId; - public Long getTextureId() { return textureId; } - public void setTextureId(Long setterArg) { this.textureId = setterArg; } + + public Long getTextureId() { + return textureId; + } + + public void setTextureId(Long setterArg) { + this.textureId = setterArg; + } private Double speed; - public Double getSpeed() { return speed; } - public void setSpeed(Double setterArg) { this.speed = setterArg; } + + public Double getSpeed() { + return speed; + } + + public void setSpeed(Double setterArg) { + this.speed = setterArg; + } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -140,12 +218,16 @@ HashMap toMap() { toMapResult.put("speed", speed); return toMapResult; } + static PlaybackSpeedMessage fromMap(HashMap map) { PlaybackSpeedMessage fromMapResult = new PlaybackSpeedMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); + fromMapResult.textureId = + (textureId == null) + ? null + : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); Object speed = map.get("speed"); - fromMapResult.speed = (Double)speed; + fromMapResult.speed = (Double) speed; return fromMapResult; } } @@ -153,12 +235,24 @@ static PlaybackSpeedMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class PositionMessage { private Long textureId; - public Long getTextureId() { return textureId; } - public void setTextureId(Long setterArg) { this.textureId = setterArg; } + + public Long getTextureId() { + return textureId; + } + + public void setTextureId(Long setterArg) { + this.textureId = setterArg; + } private Long position; - public Long getPosition() { return position; } - public void setPosition(Long setterArg) { this.position = setterArg; } + + public Long getPosition() { + return position; + } + + public void setPosition(Long setterArg) { + this.position = setterArg; + } HashMap toMap() { HashMap toMapResult = new HashMap<>(); @@ -166,12 +260,19 @@ HashMap toMap() { toMapResult.put("position", position); return toMapResult; } + static PositionMessage fromMap(HashMap map) { PositionMessage fromMapResult = new PositionMessage(); Object textureId = map.get("textureId"); - fromMapResult.textureId = (textureId == null) ? null : ((textureId instanceof Integer) ? (Integer)textureId : (Long)textureId); + fromMapResult.textureId = + (textureId == null) + ? null + : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId); Object position = map.get("position"); - fromMapResult.position = (position == null) ? null : ((position instanceof Integer) ? (Integer)position : (Long)position); + fromMapResult.position = + (position == null) + ? null + : ((position instanceof Integer) ? (Integer) position : (Long) position); return fromMapResult; } } @@ -179,269 +280,320 @@ static PositionMessage fromMap(HashMap map) { /** Generated class from Pigeon that represents data sent in messages. */ public static class MixWithOthersMessage { private Boolean mixWithOthers; - public Boolean getMixWithOthers() { return mixWithOthers; } - public void setMixWithOthers(Boolean setterArg) { this.mixWithOthers = setterArg; } + + public Boolean getMixWithOthers() { + return mixWithOthers; + } + + public void setMixWithOthers(Boolean setterArg) { + this.mixWithOthers = setterArg; + } HashMap toMap() { HashMap toMapResult = new HashMap<>(); toMapResult.put("mixWithOthers", mixWithOthers); return toMapResult; } + static MixWithOthersMessage fromMap(HashMap map) { MixWithOthersMessage fromMapResult = new MixWithOthersMessage(); Object mixWithOthers = map.get("mixWithOthers"); - fromMapResult.mixWithOthers = (Boolean)mixWithOthers; + fromMapResult.mixWithOthers = (Boolean) mixWithOthers; return fromMapResult; } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/ + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface VideoPlayerApi { void initialize(); + TextureMessage create(CreateMessage arg); + void dispose(TextureMessage arg); + void setLooping(LoopingMessage arg); + void setVolume(VolumeMessage arg); + void setPlaybackSpeed(PlaybackSpeedMessage arg); + void play(TextureMessage arg); + PositionMessage position(TextureMessage arg); + void seekTo(PositionMessage arg); + void pause(TextureMessage arg); + void setMixWithOthers(MixWithOthersMessage arg); /** Sets up an instance of `VideoPlayerApi` to handle messages through the `binaryMessenger` */ static void setup(BinaryMessenger binaryMessenger, VideoPlayerApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.initialize", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.initialize", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - api.initialize(); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + api.initialize(); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.create", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.create", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - CreateMessage input = CreateMessage.fromMap((HashMap)message); - TextureMessage output = api.create(input); - wrapped.put("result", output.toMap()); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + CreateMessage input = CreateMessage.fromMap((HashMap) message); + TextureMessage output = api.create(input); + wrapped.put("result", output.toMap()); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.dispose", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.dispose", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - TextureMessage input = TextureMessage.fromMap((HashMap)message); - api.dispose(input); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + TextureMessage input = TextureMessage.fromMap((HashMap) message); + api.dispose(input); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setLooping", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.setLooping", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - LoopingMessage input = LoopingMessage.fromMap((HashMap)message); - api.setLooping(input); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + LoopingMessage input = LoopingMessage.fromMap((HashMap) message); + api.setLooping(input); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setVolume", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.setVolume", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - VolumeMessage input = VolumeMessage.fromMap((HashMap)message); - api.setVolume(input); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + VolumeMessage input = VolumeMessage.fromMap((HashMap) message); + api.setVolume(input); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - PlaybackSpeedMessage input = PlaybackSpeedMessage.fromMap((HashMap)message); - api.setPlaybackSpeed(input); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + PlaybackSpeedMessage input = PlaybackSpeedMessage.fromMap((HashMap) message); + api.setPlaybackSpeed(input); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.play", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.play", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - TextureMessage input = TextureMessage.fromMap((HashMap)message); - api.play(input); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + TextureMessage input = TextureMessage.fromMap((HashMap) message); + api.play(input); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.position", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.position", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - TextureMessage input = TextureMessage.fromMap((HashMap)message); - PositionMessage output = api.position(input); - wrapped.put("result", output.toMap()); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + TextureMessage input = TextureMessage.fromMap((HashMap) message); + PositionMessage output = api.position(input); + wrapped.put("result", output.toMap()); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.seekTo", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.seekTo", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - PositionMessage input = PositionMessage.fromMap((HashMap)message); - api.seekTo(input); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + PositionMessage input = PositionMessage.fromMap((HashMap) message); + api.seekTo(input); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.pause", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.pause", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - TextureMessage input = TextureMessage.fromMap((HashMap)message); - api.pause(input); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + TextureMessage input = TextureMessage.fromMap((HashMap) message); + api.pause(input); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers", new StandardMessageCodec()); + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers", + new StandardMessageCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - HashMap wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - MixWithOthersMessage input = MixWithOthersMessage.fromMap((HashMap)message); - api.setMixWithOthers(input); - wrapped.put("result", null); - } - catch (Exception exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + HashMap wrapped = new HashMap<>(); + try { + @SuppressWarnings("ConstantConditions") + MixWithOthersMessage input = MixWithOthersMessage.fromMap((HashMap) message); + api.setMixWithOthers(input); + wrapped.put("result", null); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } + private static HashMap wrapError(Exception exception) { HashMap errorMap = new HashMap<>(); errorMap.put("message", exception.toString()); diff --git a/packages/video_player/video_player_platform_interface/lib/messages.dart b/packages/video_player/video_player_platform_interface/lib/messages.dart index db2e9d9432d0..5faf6fb6d048 100644 --- a/packages/video_player/video_player_platform_interface/lib/messages.dart +++ b/packages/video_player/video_player_platform_interface/lib/messages.dart @@ -14,6 +14,7 @@ class TextureMessage { pigeonMap['textureId'] = textureId; return pigeonMap; } + // ignore: unused_element static TextureMessage _fromMap(Map pigeonMap) { final TextureMessage result = TextureMessage(); @@ -36,6 +37,7 @@ class CreateMessage { pigeonMap['formatHint'] = formatHint; return pigeonMap; } + // ignore: unused_element static CreateMessage _fromMap(Map pigeonMap) { final CreateMessage result = CreateMessage(); @@ -57,6 +59,7 @@ class LoopingMessage { pigeonMap['isLooping'] = isLooping; return pigeonMap; } + // ignore: unused_element static LoopingMessage _fromMap(Map pigeonMap) { final LoopingMessage result = LoopingMessage(); @@ -76,6 +79,7 @@ class VolumeMessage { pigeonMap['volume'] = volume; return pigeonMap; } + // ignore: unused_element static VolumeMessage _fromMap(Map pigeonMap) { final VolumeMessage result = VolumeMessage(); @@ -95,6 +99,7 @@ class PlaybackSpeedMessage { pigeonMap['speed'] = speed; return pigeonMap; } + // ignore: unused_element static PlaybackSpeedMessage _fromMap(Map pigeonMap) { final PlaybackSpeedMessage result = PlaybackSpeedMessage(); @@ -114,6 +119,7 @@ class PositionMessage { pigeonMap['position'] = position; return pigeonMap; } + // ignore: unused_element static PositionMessage _fromMap(Map pigeonMap) { final PositionMessage result = PositionMessage(); @@ -131,6 +137,7 @@ class MixWithOthersMessage { pigeonMap['mixWithOthers'] = mixWithOthers; return pigeonMap; } + // ignore: unused_element static MixWithOthersMessage _fromMap(Map pigeonMap) { final MixWithOthersMessage result = MixWithOthersMessage(); @@ -141,15 +148,15 @@ class MixWithOthersMessage { class VideoPlayerApi { Future initialize() async { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); final Map? replyMap = await channel.send(null); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -159,19 +166,19 @@ class VideoPlayerApi { } else { // noop } - } + Future create(CreateMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -181,19 +188,19 @@ class VideoPlayerApi { } else { return TextureMessage._fromMap(replyMap['result']); } - } + Future dispose(TextureMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -203,19 +210,19 @@ class VideoPlayerApi { } else { // noop } - } + Future setLooping(LoopingMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -225,19 +232,19 @@ class VideoPlayerApi { } else { // noop } - } + Future setVolume(VolumeMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -247,19 +254,20 @@ class VideoPlayerApi { } else { // noop } - } + Future setPlaybackSpeed(PlaybackSpeedMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', + StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -269,19 +277,19 @@ class VideoPlayerApi { } else { // noop } - } + Future play(TextureMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -291,19 +299,19 @@ class VideoPlayerApi { } else { // noop } - } + Future position(TextureMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -313,19 +321,19 @@ class VideoPlayerApi { } else { return PositionMessage._fromMap(replyMap['result']); } - } + Future seekTo(PositionMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -335,19 +343,19 @@ class VideoPlayerApi { } else { // noop } - } + Future pause(TextureMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -357,19 +365,20 @@ class VideoPlayerApi { } else { // noop } - } + Future setMixWithOthers(MixWithOthersMessage arg) async { final Map requestMap = arg._toMap(); - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', + StandardMessageCodec()); final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - details: null); + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); } else if (replyMap['error'] != null) { final Map error = replyMap['error']; throw PlatformException( @@ -379,7 +388,6 @@ class VideoPlayerApi { } else { // noop } - } } @@ -397,12 +405,12 @@ abstract class TestHostVideoPlayerApi { void setMixWithOthers(MixWithOthersMessage arg); static void setup(TestHostVideoPlayerApi? api) { { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.initialize', + StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { api.initialize(); return {}; @@ -410,14 +418,14 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; + final Map mapMessage = + message as Map; final CreateMessage input = CreateMessage._fromMap(mapMessage); final TextureMessage output = api.create(input); return {'result': output._toMap()}; @@ -425,14 +433,14 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; + final Map mapMessage = + message as Map; final TextureMessage input = TextureMessage._fromMap(mapMessage); api.dispose(input); return {}; @@ -440,14 +448,15 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.setLooping', + StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; + final Map mapMessage = + message as Map; final LoopingMessage input = LoopingMessage._fromMap(mapMessage); api.setLooping(input); return {}; @@ -455,14 +464,15 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.setVolume', + StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; + final Map mapMessage = + message as Map; final VolumeMessage input = VolumeMessage._fromMap(mapMessage); api.setVolume(input); return {}; @@ -470,29 +480,31 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', + StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; - final PlaybackSpeedMessage input = PlaybackSpeedMessage._fromMap(mapMessage); + final Map mapMessage = + message as Map; + final PlaybackSpeedMessage input = + PlaybackSpeedMessage._fromMap(mapMessage); api.setPlaybackSpeed(input); return {}; }); } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; + final Map mapMessage = + message as Map; final TextureMessage input = TextureMessage._fromMap(mapMessage); api.play(input); return {}; @@ -500,14 +512,14 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; + final Map mapMessage = + message as Map; final TextureMessage input = TextureMessage._fromMap(mapMessage); final PositionMessage output = api.position(input); return {'result': output._toMap()}; @@ -515,14 +527,14 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; + final Map mapMessage = + message as Map; final PositionMessage input = PositionMessage._fromMap(mapMessage); api.seekTo(input); return {}; @@ -530,14 +542,14 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; + final Map mapMessage = + message as Map; final TextureMessage input = TextureMessage._fromMap(mapMessage); api.pause(input); return {}; @@ -545,15 +557,17 @@ abstract class TestHostVideoPlayerApi { } } { - const BasicMessageChannel channel = - BasicMessageChannel('dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', StandardMessageCodec()); + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', + StandardMessageCodec()); if (api == null) { channel.setMockMessageHandler(null); } else { - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = message as Map; - final MixWithOthersMessage input = MixWithOthersMessage._fromMap(mapMessage); + final Map mapMessage = + message as Map; + final MixWithOthersMessage input = + MixWithOthersMessage._fromMap(mapMessage); api.setMixWithOthers(input); return {}; }); From b6f1a58709acb08398aff92ca9f81311bda2ff30 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Thu, 15 Oct 2020 12:51:12 -0700 Subject: [PATCH 3/4] Format objective-c --- .../video_player/ios/Classes/messages.h | 57 ++--- .../video_player/ios/Classes/messages.m | 210 +++++++++--------- 2 files changed, 134 insertions(+), 133 deletions(-) diff --git a/packages/video_player/video_player/ios/Classes/messages.h b/packages/video_player/video_player/ios/Classes/messages.h index 0cde937cd0c8..84e8fc5e5cff 100644 --- a/packages/video_player/video_player/ios/Classes/messages.h +++ b/packages/video_player/video_player/ios/Classes/messages.h @@ -16,54 +16,59 @@ NS_ASSUME_NONNULL_BEGIN @class FLTMixWithOthersMessage; @interface FLTTextureMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber * textureId; +@property(nonatomic, strong, nullable) NSNumber *textureId; @end @interface FLTCreateMessage : NSObject -@property(nonatomic, copy, nullable) NSString * asset; -@property(nonatomic, copy, nullable) NSString * uri; -@property(nonatomic, copy, nullable) NSString * packageName; -@property(nonatomic, copy, nullable) NSString * formatHint; +@property(nonatomic, copy, nullable) NSString *asset; +@property(nonatomic, copy, nullable) NSString *uri; +@property(nonatomic, copy, nullable) NSString *packageName; +@property(nonatomic, copy, nullable) NSString *formatHint; @end @interface FLTLoopingMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber * textureId; -@property(nonatomic, strong, nullable) NSNumber * isLooping; +@property(nonatomic, strong, nullable) NSNumber *textureId; +@property(nonatomic, strong, nullable) NSNumber *isLooping; @end @interface FLTVolumeMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber * textureId; -@property(nonatomic, strong, nullable) NSNumber * volume; +@property(nonatomic, strong, nullable) NSNumber *textureId; +@property(nonatomic, strong, nullable) NSNumber *volume; @end @interface FLTPlaybackSpeedMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber * textureId; -@property(nonatomic, strong, nullable) NSNumber * speed; +@property(nonatomic, strong, nullable) NSNumber *textureId; +@property(nonatomic, strong, nullable) NSNumber *speed; @end @interface FLTPositionMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber * textureId; -@property(nonatomic, strong, nullable) NSNumber * position; +@property(nonatomic, strong, nullable) NSNumber *textureId; +@property(nonatomic, strong, nullable) NSNumber *position; @end @interface FLTMixWithOthersMessage : NSObject -@property(nonatomic, strong, nullable) NSNumber * mixWithOthers; +@property(nonatomic, strong, nullable) NSNumber *mixWithOthers; @end @protocol FLTVideoPlayerApi --(void)initialize:(FlutterError *_Nullable *_Nonnull)error; --(nullable FLTTextureMessage *)create:(FLTCreateMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(void)dispose:(FLTTextureMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(void)setLooping:(FLTLoopingMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(void)setVolume:(FLTVolumeMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(void)setPlaybackSpeed:(FLTPlaybackSpeedMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(void)play:(FLTTextureMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(nullable FLTPositionMessage *)position:(FLTTextureMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(void)seekTo:(FLTPositionMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(void)pause:(FLTTextureMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; --(void)setMixWithOthers:(FLTMixWithOthersMessage*)input error:(FlutterError *_Nullable *_Nonnull)error; +- (void)initialize:(FlutterError *_Nullable *_Nonnull)error; +- (nullable FLTTextureMessage *)create:(FLTCreateMessage *)input + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)dispose:(FLTTextureMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setLooping:(FLTLoopingMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setVolume:(FLTVolumeMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setPlaybackSpeed:(FLTPlaybackSpeedMessage *)input + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)play:(FLTTextureMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; +- (nullable FLTPositionMessage *)position:(FLTTextureMessage *)input + error:(FlutterError *_Nullable *_Nonnull)error; +- (void)seekTo:(FLTPositionMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; +- (void)pause:(FLTTextureMessage *)input error:(FlutterError *_Nullable *_Nonnull)error; +- (void)setMixWithOthers:(FLTMixWithOthersMessage *)input + error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FLTVideoPlayerApiSetup(id binaryMessenger, id _Nullable api); +extern void FLTVideoPlayerApiSetup(id binaryMessenger, + id _Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/video_player/video_player/ios/Classes/messages.m b/packages/video_player/video_player/ios/Classes/messages.m index a6d3f257f20a..e9b6e3cf0bc7 100644 --- a/packages/video_player/video_player/ios/Classes/messages.m +++ b/packages/video_player/video_player/ios/Classes/messages.m @@ -7,67 +7,67 @@ #error File requires ARC to be enabled. #endif -static NSDictionary* wrapResult(NSDictionary *result, FlutterError *error) { +static NSDictionary *wrapResult(NSDictionary *result, FlutterError *error) { NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { - errorDict = [NSDictionary dictionaryWithObjectsAndKeys: - (error.code ? error.code : [NSNull null]), @"code", - (error.message ? error.message : [NSNull null]), @"message", - (error.details ? error.details : [NSNull null]), @"details", - nil]; + errorDict = [NSDictionary + dictionaryWithObjectsAndKeys:(error.code ? error.code : [NSNull null]), @"code", + (error.message ? error.message : [NSNull null]), @"message", + (error.details ? error.details : [NSNull null]), @"details", + nil]; } - return [NSDictionary dictionaryWithObjectsAndKeys: - (result ? result : [NSNull null]), @"result", - errorDict, @"error", - nil]; + return [NSDictionary dictionaryWithObjectsAndKeys:(result ? result : [NSNull null]), @"result", + errorDict, @"error", nil]; } @interface FLTTextureMessage () -+(FLTTextureMessage*)fromMap:(NSDictionary*)dict; --(NSDictionary*)toMap; ++ (FLTTextureMessage *)fromMap:(NSDictionary *)dict; +- (NSDictionary *)toMap; @end @interface FLTCreateMessage () -+(FLTCreateMessage*)fromMap:(NSDictionary*)dict; --(NSDictionary*)toMap; ++ (FLTCreateMessage *)fromMap:(NSDictionary *)dict; +- (NSDictionary *)toMap; @end @interface FLTLoopingMessage () -+(FLTLoopingMessage*)fromMap:(NSDictionary*)dict; --(NSDictionary*)toMap; ++ (FLTLoopingMessage *)fromMap:(NSDictionary *)dict; +- (NSDictionary *)toMap; @end @interface FLTVolumeMessage () -+(FLTVolumeMessage*)fromMap:(NSDictionary*)dict; --(NSDictionary*)toMap; ++ (FLTVolumeMessage *)fromMap:(NSDictionary *)dict; +- (NSDictionary *)toMap; @end @interface FLTPlaybackSpeedMessage () -+(FLTPlaybackSpeedMessage*)fromMap:(NSDictionary*)dict; --(NSDictionary*)toMap; ++ (FLTPlaybackSpeedMessage *)fromMap:(NSDictionary *)dict; +- (NSDictionary *)toMap; @end @interface FLTPositionMessage () -+(FLTPositionMessage*)fromMap:(NSDictionary*)dict; --(NSDictionary*)toMap; ++ (FLTPositionMessage *)fromMap:(NSDictionary *)dict; +- (NSDictionary *)toMap; @end @interface FLTMixWithOthersMessage () -+(FLTMixWithOthersMessage*)fromMap:(NSDictionary*)dict; --(NSDictionary*)toMap; ++ (FLTMixWithOthersMessage *)fromMap:(NSDictionary *)dict; +- (NSDictionary *)toMap; @end @implementation FLTTextureMessage -+(FLTTextureMessage*)fromMap:(NSDictionary*)dict { - FLTTextureMessage* result = [[FLTTextureMessage alloc] init]; ++ (FLTTextureMessage *)fromMap:(NSDictionary *)dict { + FLTTextureMessage *result = [[FLTTextureMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; } return result; } --(NSDictionary*)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", nil]; +- (NSDictionary *)toMap { + return + [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), + @"textureId", nil]; } @end @implementation FLTCreateMessage -+(FLTCreateMessage*)fromMap:(NSDictionary*)dict { - FLTCreateMessage* result = [[FLTCreateMessage alloc] init]; ++ (FLTCreateMessage *)fromMap:(NSDictionary *)dict { + FLTCreateMessage *result = [[FLTCreateMessage alloc] init]; result.asset = dict[@"asset"]; if ((NSNull *)result.asset == [NSNull null]) { result.asset = nil; @@ -86,14 +86,20 @@ +(FLTCreateMessage*)fromMap:(NSDictionary*)dict { } return result; } --(NSDictionary*)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.asset ? self.asset : [NSNull null]), @"asset", (self.uri ? self.uri : [NSNull null]), @"uri", (self.packageName ? self.packageName : [NSNull null]), @"packageName", (self.formatHint ? self.formatHint : [NSNull null]), @"formatHint", nil]; +- (NSDictionary *)toMap { + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.asset ? self.asset : [NSNull null]), @"asset", + (self.uri ? self.uri : [NSNull null]), @"uri", + (self.packageName ? self.packageName : [NSNull null]), + @"packageName", + (self.formatHint ? self.formatHint : [NSNull null]), + @"formatHint", nil]; } @end @implementation FLTLoopingMessage -+(FLTLoopingMessage*)fromMap:(NSDictionary*)dict { - FLTLoopingMessage* result = [[FLTLoopingMessage alloc] init]; ++ (FLTLoopingMessage *)fromMap:(NSDictionary *)dict { + FLTLoopingMessage *result = [[FLTLoopingMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; @@ -104,14 +110,17 @@ +(FLTLoopingMessage*)fromMap:(NSDictionary*)dict { } return result; } --(NSDictionary*)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", (self.isLooping ? self.isLooping : [NSNull null]), @"isLooping", nil]; +- (NSDictionary *)toMap { + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", + (self.isLooping ? self.isLooping : [NSNull null]), @"isLooping", + nil]; } @end @implementation FLTVolumeMessage -+(FLTVolumeMessage*)fromMap:(NSDictionary*)dict { - FLTVolumeMessage* result = [[FLTVolumeMessage alloc] init]; ++ (FLTVolumeMessage *)fromMap:(NSDictionary *)dict { + FLTVolumeMessage *result = [[FLTVolumeMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; @@ -122,14 +131,16 @@ +(FLTVolumeMessage*)fromMap:(NSDictionary*)dict { } return result; } --(NSDictionary*)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", (self.volume ? self.volume : [NSNull null]), @"volume", nil]; +- (NSDictionary *)toMap { + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", + (self.volume ? self.volume : [NSNull null]), @"volume", nil]; } @end @implementation FLTPlaybackSpeedMessage -+(FLTPlaybackSpeedMessage*)fromMap:(NSDictionary*)dict { - FLTPlaybackSpeedMessage* result = [[FLTPlaybackSpeedMessage alloc] init]; ++ (FLTPlaybackSpeedMessage *)fromMap:(NSDictionary *)dict { + FLTPlaybackSpeedMessage *result = [[FLTPlaybackSpeedMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; @@ -140,14 +151,16 @@ +(FLTPlaybackSpeedMessage*)fromMap:(NSDictionary*)dict { } return result; } --(NSDictionary*)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", (self.speed ? self.speed : [NSNull null]), @"speed", nil]; +- (NSDictionary *)toMap { + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", + (self.speed ? self.speed : [NSNull null]), @"speed", nil]; } @end @implementation FLTPositionMessage -+(FLTPositionMessage*)fromMap:(NSDictionary*)dict { - FLTPositionMessage* result = [[FLTPositionMessage alloc] init]; ++ (FLTPositionMessage *)fromMap:(NSDictionary *)dict { + FLTPositionMessage *result = [[FLTPositionMessage alloc] init]; result.textureId = dict[@"textureId"]; if ((NSNull *)result.textureId == [NSNull null]) { result.textureId = nil; @@ -158,47 +171,49 @@ +(FLTPositionMessage*)fromMap:(NSDictionary*)dict { } return result; } --(NSDictionary*)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", (self.position ? self.position : [NSNull null]), @"position", nil]; +- (NSDictionary *)toMap { + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", + (self.position ? self.position : [NSNull null]), @"position", + nil]; } @end @implementation FLTMixWithOthersMessage -+(FLTMixWithOthersMessage*)fromMap:(NSDictionary*)dict { - FLTMixWithOthersMessage* result = [[FLTMixWithOthersMessage alloc] init]; ++ (FLTMixWithOthersMessage *)fromMap:(NSDictionary *)dict { + FLTMixWithOthersMessage *result = [[FLTMixWithOthersMessage alloc] init]; result.mixWithOthers = dict[@"mixWithOthers"]; if ((NSNull *)result.mixWithOthers == [NSNull null]) { result.mixWithOthers = nil; } return result; } --(NSDictionary*)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:(self.mixWithOthers ? self.mixWithOthers : [NSNull null]), @"mixWithOthers", nil]; +- (NSDictionary *)toMap { + return [NSDictionary + dictionaryWithObjectsAndKeys:(self.mixWithOthers ? self.mixWithOthers : [NSNull null]), + @"mixWithOthers", nil]; } @end void FLTVideoPlayerApiSetup(id binaryMessenger, id api) { { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.VideoPlayerApi.initialize" - binaryMessenger:binaryMessenger]; + binaryMessenger:binaryMessenger]; if (api) { [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; [api initialize:&error]; callback(wrapResult(nil, error)); }]; - } - else { + } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.VideoPlayerApi.create" - binaryMessenger:binaryMessenger]; + binaryMessenger:binaryMessenger]; if (api) { [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { FlutterError *error; @@ -206,16 +221,14 @@ void FLTVideoPlayerApiSetup(id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id binaryMessenger, id Date: Thu, 15 Oct 2020 17:53:01 -0700 Subject: [PATCH 4/4] Disable clang analyzer in messages.m --- packages/video_player/video_player/ios/Classes/messages.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/video_player/video_player/ios/Classes/messages.m b/packages/video_player/video_player/ios/Classes/messages.m index e9b6e3cf0bc7..58ff7292d2b2 100644 --- a/packages/video_player/video_player/ios/Classes/messages.m +++ b/packages/video_player/video_player/ios/Classes/messages.m @@ -7,6 +7,7 @@ #error File requires ARC to be enabled. #endif +#ifndef __clang_analyzer__ static NSDictionary *wrapResult(NSDictionary *result, FlutterError *error) { NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { @@ -361,3 +362,4 @@ void FLTVideoPlayerApiSetup(id binaryMessenger, id