Skip to content

Commit

Permalink
Deployed 3985792 with MkDocs version: 1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgangso committed Aug 23, 2023
1 parent 27dcba5 commit a37672f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions contributing/example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,19 @@ <h4 id="open-pigeonsplayback_platform_pigeondart">Open pigeons/playback_platform
Anything we add here will be callable from flutter and has to be implemented on the native side.</p>
<p>Let's add a setVolume() function somewhere, with a <code>double</code> to represent the volume from 0.0 to 1.0.
You almost always need to include a <code>playerId</code>, in order to know which player to work with (you'll see later).</p>
<p>We attribute the method with a @ObjCSelector with this syntax: <code>functionName:secondParam:</code>. This isn't strictly necessary but it helps keep the iOS code a bit cleaner.</p>
<p>We attribute the method with a @ObjCSelector with this syntax: <code>functionName:secondParam:</code>. This isn't strictly necessary but it helps keep the iOS code a bit cleaner.
The @async makes the generated dart code return a Future, allowing us to await it if necessary.</p>
<p>So something like this:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nd">@HostApi</span><span class="p">()</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="kd">abstract</span><span class="w"> </span><span class="kd">class</span><span class="w"> </span><span class="nc">PlaybackPlatformPigeon</span><span class="w"> </span><span class="p">{</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="w"> </span><span class="c1">// ... other methods</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="w"> </span><span class="nd">@ObjCSelector</span><span class="p">(</span><span class="s2">&quot;setVolume:volume:&quot;</span><span class="p">)</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="n">setVolume</span><span class="p">(</span><span class="kt">String</span><span class="w"> </span><span class="n">playerId</span><span class="p">,</span><span class="w"> </span><span class="kt">double</span><span class="w"> </span><span class="n">volume</span><span class="p">);</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="w"> </span><span class="c1">// ... other methods</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="p">}</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="w"> </span><span class="nd">@async</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="w"> </span><span class="nd">@ObjCSelector</span><span class="p">(</span><span class="s2">&quot;setVolume:volume:&quot;</span><span class="p">)</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="n">setVolume</span><span class="p">(</span><span class="kt">String</span><span class="w"> </span><span class="n">playerId</span><span class="p">,</span><span class="w"> </span><span class="kt">double</span><span class="w"> </span><span class="n">volume</span><span class="p">);</span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="w"> </span><span class="c1">// ... other methods</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a><span class="p">}</span>
</code></pre></div>
<p><em>Tip: You can use advanced argument types (see MediaItem, etc), pigeon will generate iOS/Android code for those too. But everything needs to be defined inside this one .dart file, as 'import' is not supported.</em></p>
<p>After any edits to playback_platform_pigeon.dart we need to run pigeon to generate everything:</p>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,5 @@ <h1 id="installation">Installation</h1>

<!--
MkDocs version : 1.5.2
Build Date UTC : 2023-08-23 09:20:26.314909+00:00
Build Date UTC : 2023-08-23 09:28:59.338418+00:00
-->
Binary file modified sitemap.xml.gz
Binary file not shown.

0 comments on commit a37672f

Please sign in to comment.