// Example: a simple Flutter screen
import 'package:flutter/material.dart';
class WelcomeScreen extends StatelessWidget {
const WelcomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Welcome')),
body: Center(
child: FilledButton(
onPressed: () => Navigator.pushNamed(context, '/start'),
child: const Text('Get started'),
),
),
);
}
}
// Example: a Firebase callable function
import { onCall, HttpsError } from 'firebase-functions/v2/https';
export const saveNote = onCall(async (request) => {
if (!request.auth) {
throw new HttpsError('unauthenticated', 'Please sign in first.');
}
const text = String(request.data?.text ?? '').trim();
if (!text) {
throw new HttpsError('invalid-argument', 'The note is empty.');
}
// Save the note for request.auth.uid ...
return { saved: true };
});
# Example: count orders by status in a CSV export
import csv
from collections import Counter
from pathlib import Path
def count_by_status(path: Path) -> Counter:
with path.open(newline="", encoding="utf-8") as f:
return Counter(row["status"] for row in csv.DictReader(f))
if __name__ == "__main__":
for status, total in count_by_status(Path("orders.csv")).items():
print(f"{status}: {total}")