This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
import 'dart:io'; | |
Future<void> main() async { | |
final server = await createServer(); | |
print('Server started: ${server.address} port ${server.port}'); | |
await handleRequests(server); | |
} | |
Future<HttpServer> createServer() async { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
import 'dart:io'; | |
import 'package:mailer/mailer.dart'; | |
import 'package:mailer/smtp_server.dart'; | |
Future<void> main() async { | |
final server = await createServer(); | |
print('Server started: ${server.address} port ${server.port}'); | |
await _handleRequests(server); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: KeyboardDemo(), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomeScreenManager { | |
void Function(String message)? onError; | |
Future<void> trySomething() async { | |
await Future.delayed(const Duration(milliseconds: 200)); | |
onError?.call('Sorry, there was an error.'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
List<String> findUniqueWords(String text) { | |
final uniqueWords = <String>{}; | |
final wordMatch = RegExp( | |
r'([\p{Letter}\u202f\u180B\u180C\u180D\u180E-]+)', | |
unicode: true, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'database_helper.dart'; | |
// Here we are using a global variable. You can use something like | |
// get_it in a production app. | |
final dbHelper = DatabaseHelper(); | |
Future<void> main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
// initialize the database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:path/path.dart'; | |
import 'package:sqflite/sqflite.dart'; | |
import 'package:path_provider/path_provider.dart'; | |
class DatabaseHelper { | |
static const _databaseName = "MyDatabase.db"; | |
static const _databaseVersion = 1; | |
static const table = 'my_table'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: download_progress_demo | |
description: Flutter download progress demo | |
publish_to: 'none' | |
version: 1.0.0+1 | |
environment: | |
sdk: '>=2.18.4 <3.0.0' | |
dependencies: | |
flutter: |
NewerOlder