2017-07-14 156 views

回答

0

下面我完美地工作在兩個AndroidiOS,我用exit(0)dart:io

import 'dart:io'; 

    @override 
    Widget build(BuildContext context) { 
    return new Scaffold(
     appBar: new AppBar(
     title: new Text(widget.title), 
    ), 
     body: new ... (...), 
      floatingActionButton: new FloatingActionButton(
      onPressed:()=> exit(0), 
      tooltip: 'Close app', 
      child: new Icon(Icons.close), 
     ), 
    ); 
    } 
1

你可以用SystemNavigator.pop()來做到這一點。

+0

這不起作用 –

+0

你得到一個錯誤信息?什麼平臺? –

+0

Android和iOS都沒有任何反應。 '使用'exit(0);'可以工作 –