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 'dart:math' as math; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { |
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:io'; | |
import 'dart:convert'; | |
import 'dart:crypto'; | |
import 'package:file/file.dart'; | |
import 'package:stream_transform/stream_transform.dart'; | |
///a function that takes a File object and a chosen hashing algorithm (e.g., SHA-256) | |
Future<String> hashFile(File file, Digest digest, int chunkSize) async { | |
final sink = AccumulatorSink<List<int>>(); | |
await file.openRead().pipe(chunkStream(file, chunkSize)).pipe(transform(digest)); |
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:example_user_app/result.dart'; | |
import 'package:example_user_app/user.dart'; | |
abstract class Core { | |
({User? user, Exception? ex}) getUser(); | |
Result getFilterNames({required String name}); | |
} | |
class CoreImpl implements Core { | |
User? user; |
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
///In this implementation, the algorithm divides the map into a grid of 0.05 degrees in width and height, which provides a ///balance between granularity and uniqueness of the address identifier. The algorithm uses a reverse geocoding API to ///retrieve the administrative area, city, and street names for the given location, and includes these components in the ///address identifier along with the grid coordinates. The format of the address identifier is designed to be human-readable ///and consistent with local addressing conventions. | |
String getAddressFromLocation(double latitude, double longitude) { | |
// Define the size of the grid in degrees | |
final double gridWidth = 0.05; | |
final double gridHeight = 0.05; | |
// Calculate the grid coordinates for the given latitude and longitude | |
final int x = ((longitude + 180) / gridWidth).floor(); | |
final int y = ((latitude + 90) / gridHeight).floor(); |
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: Deploy Flutter Appbundle to Play Store | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest |
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'; | |
class MediaQueryExample extends StatelessWidget { | |
const MediaQueryExample({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
final size = .of(context).size; | |
return Scaffold( | |
appBar: AppBar(title: const Text('MediaQuery Example')), |
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'; | |
class LayoutBuilderExample extends StatelessWidget { | |
const LayoutBuilderExample({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: const Text('LayoutBuilder Example')), | |
body: LayoutBuilder(builder: (context, constraints) { |
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: Release assets | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
release-asset: | |
name: Release (foss) |
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
```dart | |
import 'package:firebase_auth/firebase_auth.dart'; | |
abstract class AuthController { | |
Future<bool> loginUser(String email, String password); | |
Future<bool> logout(); | |
} | |
class AuthControllerImpl implements AuthController { |
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
```dart | |
import 'package:mime/mime.dart'; //add mime to pubspec.yaml | |
import 'package:uuid/uuid.dart'; //add uuid to pubspec.yaml | |
import 'package:firebase_storage/firebase_storage.dart'; //add firebase storage to pubspec.yaml | |
import 'package:path/path.dart'; //add path to pubspec.yaml | |
final firebaseStorage = FirebaseStorage.instance; | |
Future uploadFile({required File file}) async { | |
const uuid = Uuid(); |
NewerOlder