function_call_outcome Badge GitHub Build Badge MIT License Badge Flutter Platform Badge

This is a dart package inspired by GoLang's response and error parsing functionality at the same time. This package provide with a datatype that can we used to return data and exception from a function call at the same time. To provide the flexibility with the datatype of the data field in the object you can strongly couple the object to store a specific type of value by using a TypedConstructor.


  • x return a data variable and exception from a function at the same time.
  • x make data strongly coupled to store in particular datatype value only.
  • provide the ability to return multiple parameters which isn't supported in dart.

⚡️Getting started


In the dependencies: section of your pubspec.yaml, add the following line:

  function_call_outcome: ^0.0.2

Than import the package via:

import 'package:function_call_outcome/function_call_outcome.dart';


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

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  bool isCallAsync = false;
  int count = -1;
  late CallOutcome<String> result;

  Future<CallOutcome<String>> functionAsync()async{
      Future.delayed(const Duration(milliseconds: 1500),(){
      return CallOutcome(data: "Hello world from async");

  CallOutcome<String> function(){
          return CallOutcome<String>(data: "Hello world from sync");
          return CallOutcome<String>(exception: Exception("Hello world"));

  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: Text(count == -1?"Start"
        floatingActionButton: FloatingActionButton(
          onPressed: () async{
                result = await functionAsync();
                result = function();
                isCallAsync = !isCallAsync;

          child: const Icon(Icons.reply),

☀️Created and Maintained by:

Developed by:


🐛Issues & Feedback

Please file an issue! to send feedback or report a bug. Thank you!