environment_widget 1.0.0 copy "environment_widget: ^1.0.0" to clipboard
environment_widget: ^1.0.0 copied to clipboard

outdated

Flutter package to set environment.

example/lib/main.dart

import 'package:environment_widget/environment_widget.dart';
import 'package:flutter/material.dart';

Future<Widget> run({
  required Environment environment,
}) async {
  WidgetsFlutterBinding.ensureInitialized();

  //Load and check all you need

  return Application(
    environment: environment,
  );
}

class Application extends StatelessWidget {
  final Environment environment;

  const Application({
    required this.environment,
  });

  @override
  Widget build(BuildContext context) {
    return this.environment.widget(
          appWidget: MaterialApp(
            debugShowCheckedModeBanner: false,
            home: Home(
              baseURL: this.environment.baseUrl,
            ),
          ),
        );
  }
}

class Home extends StatelessWidget {
  final String? baseURL;

  const Home({
    this.baseURL,
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Environment Widget'),
      ),
      body: Center(
        child: Text(
          this.baseURL ?? '',
        ),
      ),
    );
  }
}
1
likes
0
points
48
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter package to set environment.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on environment_widget