Dart Convert String To Double Float
Complete Code For Dart Convert String To Double Float In Flutter
Main.dart
import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { String value1 = '87654321'; double value2; changeType() { value2 = double.parse(value1); print(value2); } @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( appBar: AppBar( backgroundColor: Colors.deepOrange, title: Text('Custom New Widget'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( margin: const EdgeInsets.fromLTRB(20, 10, 20, 10), child: RaisedButton( onPressed: () => changeType(), child: Text('Convert String to Double on Click'), textColor: Colors.white, color: Colors.lightBlue, padding: EdgeInsets.fromLTRB(12, 12, 12, 12), )), ]))) ); } }