You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import'dart:typed_data';
import'package:flutter/material.dart';
import'package:flutter/services.dart';
import'package:http/http.dart'as http;
Future<ByteData> fetchFont() async {
final response =await http.get(
'https://raw.githubusercontent.com/google/fonts/master/ofl/montserrat/Montserrat-Light.ttf');
if (response.statusCode ==200) {
returnByteData.view(response.bodyBytes.buffer);
} else {
// If that call was not successful, throw an error.throwException('Failed to load font');
}
}
voidmain() async {
var fontLoader =FontLoader('Montserrat');
fontLoader.addFont(fetchFont());
await fontLoader.load();
runApp(MyApp());
}
classMyAppextendsStatelessWidget {
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title:'Custom Fonts',
home:MyHomePage(),
);
}
}
classMyHomePageextendsStatelessWidget {
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
appBar:AppBar(title:Text('Custom Fonts')),
body:Center(
child:Text(
'Montserrat is displayed here',
style:TextStyle(fontFamily:'Montserrat'),
),
),
);
}
}
Target Platform:: Web Target OS version/browser:: MacOS/chrome
Logs
The following error is produced in the chrome console:
:57711/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
errors.dart:145 Uncaught (in promise) Error: Unsupported operation: loadFontFromList is not supported.
at Object.throw_ [as throw] (errors.dart:194)
at Object.loadFontFromList (text.dart:1384)
at font_loader.FontLoader.new.loadFont (font_loader.dart:75)
at font_loader.dart:62
at _RootZone.runUnary (zone.dart:1379)
at _FutureListener.then.handleValue (future_impl.dart:137)
at handleValueCallback (future_impl.dart:678)
at Function._propagateToListeners (future_impl.dart:707)
at _Future.new.[_completeWithValue] (future_impl.dart:522)
at async._AsyncCallbackEntry.new.callback (future_impl.dart:552)
at Object._microtaskLoop (schedule_microtask.dart:41)
at _startMicrotaskLoop (schedule_microtask.dart:50)
at async_patch.dart:166
Flutter doctor output:
[✓] Flutter (Channel master, v1.10.2-pre.950, on Mac OS X 10.14.6 18G87, locale en-US)
• Flutter version 1.10.2-pre.950 at /Users/johnsonmh/mdc/flutter
• Framework revision 6cb6857f92 (13 days ago), 2019-11-14 16:50:17 -0500
• Engine revision 77c3512ec8
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/johnsonmh/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-stable, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
• CocoaPods version 1.7.5
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio
• Android Studio at /Applications/Android Studio with Blaze.app/Contents
• Flutter plugin version 41.2.3
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (4 available)
• iPhone 11 Pro Max • 51ED21D6-0095-4C79-8B9B-A556005909CF • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
• macOS • macOS • darwin-x64 • Mac OS X 10.14.6 18G87
• Chrome • chrome • web-javascript • Google Chrome 78.0.3904.108
• Web Server • web-server • web-javascript • Flutter Tools
! Doctor found issues in 1 category.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Steps to Reproduce
Run the following app on Web:
Target Platform:: Web
Target OS version/browser:: MacOS/chrome
Logs
The following error is produced in the chrome console:
Flutter doctor output:
The text was updated successfully, but these errors were encountered: