calculator_plugin 0.0.3 icon indicating copy to clipboard operation
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
90
pub points
21%
popularity

Publisher

unverified uploader

A new Flutter plugin for calculator operations

Homepage

Documentation

API reference

License

Icon for licenses.Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on calculator_plugin