flutterflow_flash_beta 0.1.5
flutterflow_flash_beta: ^0.1.5 copied to clipboard
Dart SDK for programmatically reading and modifying FlutterFlow projects. Built for the beta environment.
example/main.dart
import 'dart:io';
import 'package:flutterflow_flash_beta/flutterflow_flash.dart';
/// Builds a simple starter app with one page.
void buildStarterApp(App app) {
app.themeColor('primary', 0xFF0B57D0);
app.themeColor('primaryBackground', 0xFFF7F9FC);
app.primaryFont('Inter');
app.page(
'StarterPage',
route: '/',
isInitial: true,
description: 'Simple starter page for a new Flash app.',
body: Scaffold(
appBar: AppBar(title: 'Flash Example'),
body: Container(
padding: 24,
child: Column(
spacing: 16,
crossAxis: CrossAxis.start,
children: [
Text(
'Build FlutterFlow apps with Dart',
style: Styles.headlineSmall,
),
Text(
'Flash keeps changes reviewable, repeatable, and ready for AI-assisted workflows.',
style: Styles.bodyMedium,
color: Colors.secondaryText,
),
Button(
'Show Snackbar',
width: double.infinity,
onTap: Snackbar('Flash is wired correctly.'),
),
],
),
),
),
);
}
/// Exercises the real Flash compile + validate path offline, without
/// requiring credentials or network access.
///
/// Usage:
/// dart run example/main.dart
/// flash validate example/main.dart --project-name "Flash Example"
void main() {
final app = buildApp(buildStarterApp);
final compiled = compileApp(app);
final page = findPage(compiled.project, name: 'StarterPage');
if (page == null) {
stderr.writeln('Error: StarterPage not found after compilation.');
exit(1);
}
stdout.writeln(
'Compiled Flash app: ${app.pages.length} page(s), '
'root widget type: ${page.node.type}.',
);
stdout.writeln('Validation passed — the DSL compiles correctly.');
stdout.writeln('');
stdout.writeln('To push to FlutterFlow:');
stdout.writeln(
' flash run example/main.dart --project-name "Flash Example" '
'--commit-message "Create starter app"',
);
}