Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/cloud_functions_tvos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dart / Flutter
.dart_tool/
build/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub/

# CocoaPods
tvos/Pods/
tvos/Podfile.lock
tvos/.symlinks/
tvos/Flutter/Flutter.framework
tvos/Flutter/Flutter.podspec

# Xcode / SwiftPM (per-user, generated when tvos/Package.swift is opened)
**/.swiftpm/
**/xcuserdata/

# IDE
.idea/
.vscode/
*.iml

# macOS
.DS_Store
1 change: 1 addition & 0 deletions packages/cloud_functions_tvos/.pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pubspec_overrides.yaml
4 changes: 4 additions & 0 deletions packages/cloud_functions_tvos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 0.0.1

* Initial tvOS scaffolding generated by `flutter-tvos plugin port` from
`cloud_functions`.
26 changes: 26 additions & 0 deletions packages/cloud_functions_tvos/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright 2018, the Chromium project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 changes: 50 additions & 0 deletions packages/cloud_functions_tvos/PORTING_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# cloud_functions_tvos — porting report

Generated by `flutter-tvos plugin port` on 2026-08-14.

Source: `cloud_functions` 6.3.3 (Swift). Base platform: ios.
Output: `./cloud_functions_tvos`

> ✅ No tvOS-incompatible APIs detected at type level — the generated package is expected to compile on tvOS (still review stubbed/partial items below).

## Summary

| Status | Count |
|---|---|
| Methods ported as-is | 0 |
| Methods stubbed (iOS-only) | 0 |
| Native regions disabled on tvOS | 0 |
| tvOS build outlook | ✅ expected to compile |
| Manual review items | 0 |

## Methods

No `case "<method>":` handlers were detected in the source. Either the plugin dispatches method calls in a non-standard way (review `tvos/Classes/` by hand) or it has no method channel.

## Imports removed

None. Every `import` in the source compiles on tvOS.

## Cross-platform Dart pruned

None. The source ships no Dart files for non-Apple platforms — nothing had to be removed.

## Disabled on tvOS

None. No type-level tvOS-incompatible API was found; nothing had to be compiled out.

## Manual review items

None flagged automatically. You should still skim `tvos/Classes/` — regex-based porting is best-effort and cannot catch every obfuscated API use.

## Checklist

- [ ] Read every `✗ stubbed` method above and confirm returning `FlutterMethodNotImplemented` is acceptable on tvOS.
- [ ] Review every `⚠️ partial` method against a real Apple TV (behaviour differs from iOS).
- [ ] Confirm the removed imports were not load-bearing for still-supported code paths.
- [ ] `flutter-tvos build tvos --simulator --debug` from the plugin's example app compiles the generated registrant.
- [ ] Bump the version and update `CHANGELOG.md` before publishing.

---

Manual review required. Read this report top-to-bottom before publishing `cloud_functions_tvos`.
32 changes: 32 additions & 0 deletions packages/cloud_functions_tvos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# cloud_functions_tvos

The tvOS implementation of [`cloud_functions`](https://pub.dev/packages/cloud_functions).

> Generated by [`flutter-tvos plugin port`](https://github.com/fluttertv/flutter-tvos)
> from `cloud_functions`. Read `PORTING_REPORT.md` before publishing.

## Usage

This is a federated plugin implementation. Apps that already depend on
`cloud_functions` and target tvOS only need to add this package as a
dependency:

```yaml
dependencies:
cloud_functions: ^<latest>
cloud_functions_tvos: ^0.0.1
```

The plugin registers automatically via Flutter's federated registry — no
explicit imports required from app code.

## Status

| Platform | Implemented |
|----------|-------------|
| Apple TV (`appletvos`) | yes |
| Apple TV simulator (`appletvsimulator`) | yes |

## License

fluttertv under a BSD-3-Clause license. See `LICENSE` for the full text.
7 changes: 7 additions & 0 deletions packages/cloud_functions_tvos/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include: package:flutter_lints/flutter.yaml

analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
37 changes: 37 additions & 0 deletions packages/cloud_functions_tvos/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# cloud_functions_tvos example (Apple TV)

Minimal app that invokes a Firebase **callable** Cloud Function from tvOS, to
verify the `cloud_functions_tvos` federated plugin on the Simulator and a
physical Apple TV.

## 1. Connect it to Firebase

On tvOS, `defaultTargetPlatform == TargetPlatform.iOS`, so the **iOS Firebase
app config is what tvOS uses** — no separate tvOS app needed.

```bash
cd packages/cloud_functions_tvos/example
flutterfire configure # pick your project → select the iOS app
```
(or hand-fill `lib/firebase_options.dart`'s `ios` block from your iOS app's
`GoogleService-Info.plist` / the Firebase console).

Deploy a callable named `listFruit` (or edit the name in `lib/main.dart`):
```js
// functions/index.js
exports.listFruit = require("firebase-functions/v2/https")
.onCall(() => ["apple", "banana", "cherry"]);
```

## 2. Run it

```bash
export PATH="/path/to/flutter-tvos/bin:$PATH"
flutter-tvos pub get
open -a Simulator # boot a tvOS simulator
flutter-tvos run -d "Apple TV" # or a physical Apple TV
```

Press **call `httpsCallable("listFruit")`** with the Siri Remote. A returned
result (or even a `FirebaseFunctionsException` from the backend) confirms the
call reached Cloud Functions from Apple TV — i.e. the plugin works end-to-end.
35 changes: 35 additions & 0 deletions packages/cloud_functions_tvos/example/lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// PLACEHOLDER — replace by running `flutterfire configure` in this example dir.
//
// On tvOS, `defaultTargetPlatform == TargetPlatform.iOS`, so the `ios` entry
// below is what the Apple TV build uses — i.e. your existing iOS Firebase app's
// config is reused for tvOS.
//
// ignore_for_file: lines_longer_than_80_chars
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;

class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError('This example targets Apple TV (tvOS) only.');
}
switch (defaultTargetPlatform) {
case TargetPlatform.iOS: // tvOS reports iOS
return ios;
default:
throw UnsupportedError('This example targets Apple TV (tvOS) only.');
}
}

// Replace with your real values — run `flutterfire configure`, or copy them
// from your iOS app's GoogleService-Info.plist / Firebase console.
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'REPLACE_ME',
appId: 'REPLACE_ME', // GOOGLE_APP_ID
messagingSenderId: 'REPLACE_ME', // GCM_SENDER_ID
projectId: 'REPLACE_ME',
storageBucket: 'REPLACE_ME',
iosBundleId: 'com.example.cloudFunctionsExample',
);
}
76 changes: 76 additions & 0 deletions packages/cloud_functions_tvos/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:cloud_functions/cloud_functions.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';

import 'firebase_options.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(const FunctionsExampleApp());
}

class FunctionsExampleApp extends StatelessWidget {
const FunctionsExampleApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'cloud_functions tvOS example',
theme: ThemeData.dark(useMaterial3: true),
home: const FunctionsHomePage(),
);
}
}

class FunctionsHomePage extends StatefulWidget {
const FunctionsHomePage({super.key});

@override
State<FunctionsHomePage> createState() => _FunctionsHomePageState();
}

class _FunctionsHomePageState extends State<FunctionsHomePage> {
String _status = 'Ready — call a callable function with the Siri Remote.';

Future<void> _callFunction() async {
setState(() => _status = 'calling…');
try {
// Replace 'listFruit' with a callable you have deployed to your project.
final callable = FirebaseFunctions.instance.httpsCallable('listFruit');
final result = await callable.call<dynamic>();
setState(() => _status = '✅ result: ${result.data}');
} on FirebaseFunctionsException catch (e) {
// Reaching the backend (even an error) proves the plugin works on tvOS.
setState(() => _status = '⚠️ FunctionsException [${e.code}]: ${e.message}');
} catch (e) {
setState(() => _status = '❌ $e');
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('cloud_functions · tvOS')),
body: Padding(
padding: const EdgeInsets.all(48),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(_status, style: const TextStyle(fontSize: 26)),
const SizedBox(height: 32),
ElevatedButton(
autofocus: true,
onPressed: _callFunction,
child: const Text('call httpsCallable("listFruit")'),
),
],
),
),
);
}
}
29 changes: 29 additions & 0 deletions packages/cloud_functions_tvos/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: cloud_functions_example
description: Demonstrates how to use the cloud_functions plugin on tvOS.
publish_to: none

environment:
sdk: '^3.6.0'
flutter: '>=3.27.0'

dependencies:
# Pinned exact to the 4.11.x train (firebase_core_platform_interface 7.1.0)
# that firebase_core_tvos ships on — 6.3.6 / firebase_core 4.13.0 drift to
# platform_interface 8.1.0 (14-field FirebaseOptions) and mismatch the native
# Pigeon, crashing at launch under Dart options: init.
cloud_functions: 6.3.3
cloud_functions_tvos:
path: ../
firebase_core: 4.11.0
firebase_core_tvos:
path: ../../firebase_core_tvos
flutter:
sdk: flutter

dev_dependencies:
flutter_lints: ^4.0.0
flutter_test:
sdk: flutter

flutter:
uses-material-design: true
7 changes: 7 additions & 0 deletions packages/cloud_functions_tvos/example/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Local development override for the example app. Forces firebase_core_tvos
# to the sibling package so the example resolves against the plugin's hosted
# `^0.0.1` constraint before that package is published. Gitignored; examples
# are not published. Remove once firebase_core_tvos 0.0.1 is on pub.dev.
dependency_overrides:
firebase_core_tvos:
path: ../../firebase_core_tvos
34 changes: 34 additions & 0 deletions packages/cloud_functions_tvos/example/tvos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
Loading