dino_flutter 1.0.0-pre.1 copy "dino_flutter: ^1.0.0-pre.1" to clipboard
dino_flutter: ^1.0.0-pre.1 copied to clipboard

An integration of the dino package with the flutter framework.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:dino/dino.dart';
import 'package:dino_flutter/dino_flutter.dart';

class Calculator {
  int sum(int a, int b) => a + b;
}

Future<void> main() async {
  final ServiceCollection services = ServiceCollection();

  services.addInstance(Calculator());

  final scope = services.buildRootScope();
  await scope.initialize();

  runApp(
    DinoProvider(
      serviceProvider: scope.serviceProvider,
      child: Application(),
    ),
  );
}

class Application extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Dino Flutter Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final calculator = context.sp.getRequired<Calculator>();

    return Scaffold(
      appBar: AppBar(
        title: Text('Dino Flutter Example'),
      ),
      body: Center(
        child: Text('${calculator.sum(1, 2)}'),
      ),
    );
  }
}
0
likes
150
points
31
downloads

Publisher

verified publisherexeteres.dev

Weekly Downloads

An integration of the dino package with the flutter framework.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

dino, flutter

More

Packages that depend on dino_flutter