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

A new Flutter plugin for calculator operations

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:calculator_plugin/calculator_plugin.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String number;

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    int num;
    try {
      num = await CalculatorPlugin.calculatordiv(30, 15);
    } on PlatformException {
      number = 'Failed to get number.';
    }

    if (!mounted) return;

    setState(() {
      number = num.toString();
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Added number: $number'),
        ),
      ),
    );
  }
}
1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A new Flutter plugin for calculator operations

Homepage

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on calculator_plugin