<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: abhiram-ms</title>
    <description>The latest articles on DEV Community by abhiram-ms (@abhiramms).</description>
    <link>https://dev.to/abhiramms</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F945656%2Fec09311c-433e-433d-b5ad-d143eaf7f86d.png</url>
      <title>DEV Community: abhiram-ms</title>
      <link>https://dev.to/abhiramms</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhiramms"/>
    <language>en</language>
    <item>
      <title>Unhandled Exception: type 'Null' is not a subtype of type 'int' in type cast error when trying to call function with no int</title>
      <dc:creator>abhiram-ms</dc:creator>
      <pubDate>Sun, 16 Oct 2022 11:14:12 +0000</pubDate>
      <link>https://dev.to/abhiramms/unhandled-exception-type-null-is-not-a-subtype-of-type-int-in-type-cast-error-when-trying-to-call-function-with-no-int-1ga3</link>
      <guid>https://dev.to/abhiramms/unhandled-exception-type-null-is-not-a-subtype-of-type-int-in-type-cast-error-when-trying-to-call-function-with-no-int-1ga3</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;div class="ltag__stackexchange--header"&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7Gn-iPj_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
          &lt;a href="https://stackoverflow.com/questions/74077921/unhandled-exception-type-null-is-not-a-subtype-of-type-int-in-type-cast-err" rel="noopener noreferrer"&gt;
            Unhandled Exception: type 'Null' is not a subtype of type 'int' in type cast error when trying to call function with no int
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Oct 15 '22&lt;/span&gt;
            &lt;span&gt;Comments: 1&lt;/span&gt;
            &lt;span&gt;Answers: 0&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/74077921/unhandled-exception-type-null-is-not-a-subtype-of-type-int-in-type-cast-err" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y9mJpuJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          1
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wif5Zq3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;Hello I was calling a startelection function from my flutter app on a button click and I got this error
the startelection function connects my flutter app with my solidity smart contract and starts the election through infura
I don't know why I am getting this error it was running…&lt;/p&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    &lt;a href="https://stackoverflow.com/questions/74077921/unhandled-exception-type-null-is-not-a-subtype-of-type-int-in-type-cast-err" class="ltag__stackexchange--btn" rel="noopener noreferrer"&gt;Open Full Question&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Unhandled Exception: type 'Null' is not a subtype of type 'int' in type cast error when trying to call function with no int</title>
      <dc:creator>abhiram-ms</dc:creator>
      <pubDate>Sun, 16 Oct 2022 11:12:59 +0000</pubDate>
      <link>https://dev.to/abhiramms/unhandled-exception-type-null-is-not-a-subtype-of-type-int-in-type-cast-error-when-trying-to-call-function-with-no-int-4gg6</link>
      <guid>https://dev.to/abhiramms/unhandled-exception-type-null-is-not-a-subtype-of-type-int-in-type-cast-error-when-trying-to-call-function-with-no-int-4gg6</guid>
      <description>&lt;p&gt;Hello I was calling a startelection function from my flutter app on a button click and I got this error the startelection function connects my flutter app with my solidity smart contract and starts the election through infura I don't know why I am getting this error it was running fine before&lt;/p&gt;

&lt;p&gt;error : &lt;br&gt;
&lt;code&gt;&lt;br&gt;
E/flutter (31094): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: type 'Null' is not a subtype of type 'int' in type cast&lt;br&gt;
E/flutter (31094): #0      JsonRPC.call (package:web3dart/json_rpc.dart:53:27)&lt;br&gt;
E/flutter (31094): &amp;lt;asynchronous suspension&amp;gt;&lt;br&gt;
E/flutter (31094): #1      Web3Client._makeRPCCall (package:web3dart/src/core/client.dart:54:20)&lt;br&gt;
E/flutter (31094): &amp;lt;asynchronous suspension&amp;gt;&lt;br&gt;
E/flutter (31094): #2      Web3Client.getGasPrice (package:web3dart/src/core/client.dart:175:18)&lt;br&gt;
E/flutter (31094): &amp;lt;asynchronous suspension&amp;gt;&lt;br&gt;
E/flutter (31094): #3      _fillMissingData (package:web3dart/src/core/transaction_signer.dart:36:16)&lt;br&gt;
E/flutter (31094): &amp;lt;asynchronous suspension&amp;gt;&lt;br&gt;
E/flutter (31094): #4      Web3Client.signTransaction (package:web3dart/src/core/client.dart:316:26)&lt;br&gt;
E/flutter (31094): &amp;lt;asynchronous suspension&amp;gt;&lt;br&gt;
E/flutter (31094): #5      Web3Client.sendTransaction (package:web3dart/src/core/client.dart:285:18)&lt;br&gt;
E/flutter (31094): &amp;lt;asynchronous suspension&amp;gt;&lt;br&gt;
E/flutter (31094): #6      startElection (package:election/services/functions.dart:29:18)&lt;br&gt;
E/flutter (31094): &amp;lt;asynchronous suspension&amp;gt;&lt;br&gt;
E/flutter (31094): #7      _HomeState.build.&amp;lt;anonymous closure&amp;gt; (package:election/pages/home.dart:53:25)&lt;br&gt;
E/flutter (31094): &amp;lt;asynchronous suspension&amp;gt;&lt;br&gt;
E/flutter (31094):&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;home.dart &lt;br&gt;
`&lt;br&gt;
import 'package:election/utils/Constants.dart';&lt;br&gt;
import 'package:flutter/material.dart';&lt;br&gt;
import 'package:http/http.dart';&lt;br&gt;
import 'package:web3dart/web3dart.dart';&lt;/p&gt;

&lt;p&gt;import '../services/functions.dart';&lt;br&gt;
import 'Electioninfo.dart';&lt;/p&gt;

&lt;p&gt;class Home extends StatefulWidget {&lt;br&gt;
  const Home({Key? key}) : super(key: key);&lt;/p&gt;

&lt;p&gt;@override&lt;br&gt;
  State createState() =&amp;gt; _HomeState();&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;class _HomeState extends State {&lt;br&gt;
  late Client? httpClient;&lt;br&gt;
  late Web3Client? ethclient;&lt;br&gt;
  TextEditingController controller = TextEditingController();&lt;/p&gt;

&lt;p&gt;@override&lt;br&gt;
  void initState() {&lt;br&gt;
    httpClient = Client();&lt;br&gt;
    ethclient = Web3Client(infura_url, httpClient!);&lt;br&gt;
    super.initState();&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;@override&lt;br&gt;
  Widget build(BuildContext context) {&lt;br&gt;
    return Scaffold(&lt;br&gt;
      appBar: AppBar(&lt;br&gt;
        title: const Text('Start Election'),&lt;br&gt;
      ),&lt;br&gt;
      body: Container(&lt;br&gt;
        padding: const EdgeInsets.all(14),&lt;br&gt;
        child: Column(&lt;br&gt;
          mainAxisAlignment: MainAxisAlignment.center,&lt;br&gt;
          children: [&lt;br&gt;
            TextField(&lt;br&gt;
              controller: controller,&lt;br&gt;
              decoration: const InputDecoration(&lt;br&gt;
                  filled: true, hintText: 'Enter election name'),&lt;br&gt;
            ),&lt;br&gt;
            const SizedBox(&lt;br&gt;
              height: 10,&lt;br&gt;
            ),&lt;br&gt;
            Container(&lt;br&gt;
                width: double.infinity,&lt;br&gt;
                height: 45,&lt;br&gt;
                child: ElevatedButton(&lt;br&gt;
                    onPressed: () async {&lt;br&gt;
                      if (controller.text.isNotEmpty) {&lt;br&gt;
                        await startElection(controller.text, ethclient!);&lt;br&gt;
                        if(!mounted)return;&lt;br&gt;
                        Navigator.push(&lt;br&gt;
                            context,&lt;br&gt;
                            MaterialPageRoute(&lt;br&gt;
                                builder: (context) =&amp;gt; ElectionInfo(&lt;br&gt;
                                      ethClient: ethclient!,&lt;br&gt;
                                      electionName: controller.text,&lt;br&gt;
                                    )));&lt;br&gt;
                      }&lt;br&gt;
                    },&lt;br&gt;
                    child: const Text('Start Election')))&lt;br&gt;
          ],&lt;br&gt;
        ),&lt;br&gt;
      ),&lt;br&gt;
    );&lt;br&gt;
  }&lt;br&gt;
}`&lt;/p&gt;

&lt;p&gt;functions.dart:&lt;/p&gt;

&lt;p&gt;`Future startElection(String name,Web3Client ethclient) async{&lt;/p&gt;

&lt;p&gt;var response = await callFunction('startElection', [name], ethclient, owner_private_key);&lt;br&gt;
  print("election started successfully");&lt;/p&gt;

&lt;p&gt;return response;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Future callFunction(String funcname,Listargs,Web3Client ethClient,String privateKey) async{&lt;/p&gt;

&lt;p&gt;EthPrivateKey credentials = EthPrivateKey.fromHex(privateKey);&lt;br&gt;
  DeployedContract contract = await loadcontract();&lt;/p&gt;

&lt;p&gt;final ethfunction = contract.function(funcname);&lt;br&gt;
  final result = ethClient.sendTransaction(&lt;br&gt;
      credentials,Transaction.callContract(contract: contract, function: ethfunction, parameters: args),&lt;br&gt;
    chainId: null,fetchChainIdFromNetworkId: true);&lt;/p&gt;

&lt;p&gt;return result;&lt;br&gt;
}`&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>null</category>
      <category>dart</category>
      <category>vscode</category>
    </item>
  </channel>
</rss>
