flutter_env_native 0.1.0 flutter_env_native: ^0.1.0 copied to clipboard
A plugin/utility that provides compile-time variables for native platforms.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String name = const String.fromEnvironment("APP_NAME");
String suffix = const String.fromEnvironment("APP_SUFFIX");
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('name: $name\n'),
Text('suffix: $suffix\n'),
],
),
),
),
);
}
}