flutter_domain_manager 0.0.3 copy "flutter_domain_manager: ^0.0.3" to clipboard
flutter_domain_manager: ^0.0.3 copied to clipboard

Platformweb

Easily manage subdomains for multiple environments / tenants in Flutter web applications.

example/lib/main.dart

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

void main() {
  DomainManager.register(
    config: DomainManagerConfig(
      // Advised to get it from the dotenv file or environment variables
      domain: 'http://localhost:3000',
      // Advised to get it from a database
      allowedCompanies: ['iconica'],
      // Advised to get it from the dotenv file or environment variables
      debugCompany: 'iconica',
    ),
  );

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,

        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[Text(DomainManager.instance.company ?? 'Unknown')],
        ),
      ),
    );
  }
}
3
likes
150
points
59
downloads

Publisher

verified publishericonica.nl

Weekly Downloads

Easily manage subdomains for multiple environments / tenants in Flutter web applications.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, web

More

Packages that depend on flutter_domain_manager