Currently working on flutter web gui and handling blob storage and data visualization. The web GUI is running in local host , I want to run the app in azure app services is it possible. If possible how to do it?
when I try to create it asks for web-app or static web app.
below is the program
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
// ignore: camel_case_types
class alt extends StatelessWidget {
const alt({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () async {
await main();
},
child: const Text('Fetch Blob Data'),
),
),
),
);
}
Future<void> main() async {
String sasUrl =
'https://stroageMM.blob.core.windows.net/binfile/ledblink.bin?sp=r&st=2024-02-13T06:58:48Z&se=2024-02-13T14:58:48Z&sv=2022-11-02&sr=b&sig=aa2%2BdywACIb2jU4ErTGDtrWLpKaFJtJt60xdewlJd7o%3D';
try {
// Send HTTP GET request to the SAS URL
final response = await http.get(Uri.parse(sasUrl));
if (response.statusCode == 200) {
// Parse response body as bytes
Uint8List bytes = response.bodyBytes;
// Handle the data as needed
// For example, you can decode the bytes to a string or save them to a file
if (kDebugMode) {
print('Received ${bytes.length} bytes of data.');
}
// Example: Decode bytes to a string
String data = String.fromCharCodes(bytes);
if (kDebugMode) {
print('Data: $data');
}
} else {
if (kDebugMode) {
print('Failed to fetch data: ${response.statusCode}');
}
}
} catch (e) {
if (kDebugMode) {
print('Error fetching data: $e');
}
}
}
}
Below are the steps for deploying a Flutter web application to Azure App Services using Azure Static Web Apps:
Enable Web Support:
You need to run the following commands to use the beta channel and enable web support:
flutter createcommand to generate a new Flutter web project:flutter build webcommand to compile:swa initcommand to set up the configuration for deploying your app to Azure Static Web Apps:swa-cli.config.jsonin the root path:swa buildcommand to build your Flutter web app in preparation for deployment.swa deploycommand to deploy your app to Azure App Services using Azure Static Web Apps.The below sample Flutter web GUI code connects to Azure Blob Storage using a SAS URL and visualizes data in the UI:
lib/main.dart:
Azure Storage:
swa buildandswa deployto build and deploy to Azure.