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_riverpod/flutter_riverpod.dart'; | |
//a state notifier that can be used to call a future after an event. | |
//it will automatically update the state when the future completes | |
//call [doRequest] to call the future | |
//pass in [request] to the [doRequest] function or in the constructor | |
//the [request] in the doRequest function will take precendence over the [request] in the constructor | |
class FutureStateNotifier<T> extends StateNotifier<AsyncValue<T>> { | |
FutureStateNotifier({this.request}) : super(AsyncValue<T>.loading()); | |
final Future<T> Function()? request; |
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:math' as math; | |
List<double> loadparseJson(String jsonBody) { | |
final data = jsonDecode(jsonBody); | |
final List<int> points = List.castFrom(data['data']); | |
List<int> filteredData = []; | |
// Change this value to number of audio samples you want. | |
// Values between 256 and 1024 are good for showing [RectangleWaveform] and [SquigglyWaveform] |
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 { dataProcessor } from "./processors"; | |
export const parseDataToAlgoliaFormat = (snapshot: { [key: string]: any }) => { | |
let payload: { | |
[key: string]: boolean | string | number; | |
} = { | |
objectID: snapshot.id ?? snapshot.objectID, | |
path: snapshot.path | |
}; |
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 ScrollBar extends StatefulWidget { | |
const ScrollBar({ | |
Key? key, | |
required this.scrollController, | |
}) : super(key: key); | |
final ScrollController scrollController; |
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:coves_management/notifiers/pagination/pagination_notifier_state.dart'; | |
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
import 'package:logging/logging.dart'; | |
class PaginationNotifier<T> extends StateNotifier<PaginationNotifierState<T>> { | |
PaginationNotifier({required this.fetchNextItems, required this.hitsPerPage}) | |
: super(const PaginationNotifierState.data([], false)) { | |
init(); | |
} |
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:chaseapp/src/const/other.dart'; | |
import 'package:flutter/material.dart'; | |
// https://github.com/flutter/flutter/issues/10667 | |
// Navigator.push( | |
// context, | |
// HeroDialogRoute<void>( | |
// builder: (context) { | |
// return Dialog(); | |
// }, |
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
// Get Tweet info along with user info if needed by expanding to user | |
final http.Response responce = await http.get( | |
Uri.parse( | |
'https://api.twitter.com/2/tweets?ids=$tweetId&expansions=author_id&user.fields=name,profile_image_url', | |
), | |
headers: { | |
'Authorization': 'Bearer ${Bearer Token}', | |
}, | |
); |
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
final databaseProvider = Provider<MyDatabase>( (ref) => MyDatabase()); | |
final itemsProvider = FutureProvider<List<Item>>( (ref) async { | |
return ref.read(databaseProvider).fetchItems() ; | |
}); |
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 TwitterEmbed extends StatefulWidget { | |
const TwitterEmbed({Key? key}) : super(key: key); | |
@override | |
State<TwitterEmbed> createState() => _TwitterEmbedState(); | |
} | |
class _TwitterEmbedState extends State<TwitterEmbed> { | |
@override |
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 TwitterEmbed extends StatefulWidget { | |
const TwitterEmbed({Key? key}) : super(key: key); | |
@override | |
State<TwitterEmbed> createState() => _TwitterEmbedState(); | |
} | |
class _TwitterEmbedState extends State<TwitterEmbed> { | |
@override |